OpenJSCAD.org icon indicating copy to clipboard operation
OpenJSCAD.org copied to clipboard

performance improvments to booleans

Open z3dev opened this issue 6 months ago • 6 comments

After contemplating the internals of the boolean Trees, I decided to try removing 'remove' in PolygonTreeNode. That worked well after determining how the poly tree nodes were being formed, split and used.

Once 'remove' was gone then it became apparent that the strange queues for the children were also unnecessary.

A few of the tests has a different order of polygons, but otherwise perfect.

All Submissions:

  • [x] Have you followed the guidelines in our Contributing document?
  • [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • [x] Does your submission pass tests?

z3dev avatar May 31 '25 08:05 z3dev

@platypii This is finally ready. JavaScript is a very weird language / runtime. I actually had to revert some of the new versions to achieve improved performance. And all I can say is... the runtime stack is very very slow.

Performance has been improved, but I won't know the full impact until updating and re-running the test suites again.

Here's an example from one of my more complex designs.

OLD

time node ./cli.js raspberry-pi-2-case.js
JSCAD: generating output 
    from:  raspberry-pi-2-case.js 
    to:  raspberry-pi-2-case.stl (STereoLithography, ASCII) 
  

real	0m4.816s
user	0m6.791s
sys	0m0.406s

NEW

time node ./cli.js raspberry-pi-2-case.js
JSCAD: generating output 
    from:  raspberry-pi-2-case.js 
    to:  raspberry-pi-2-case.stl (STereoLithography, ASCII) 
  

real	0m4.087s
user	0m5.738s
sys	0m0.361s

z3dev avatar Jun 08 '25 06:06 z3dev

I'm trying to test this locally but I'm struggling to get the web server running locally on V3 branch right now?

I did a fresh clone, then pnpm install, and pnpm test passes in the top level directory. How do I start the web server again? (its been a minute since I ran this). I have not been able to find a combination of npm/pnpm/lerna commands that works? The closest I got started the server but had errors about nanohtml missing, or a different error about using import in core/index.js

Can you give the exact steps you use on a fresh install? I think the instructions in the repo are not up to date?

platypii avatar Jun 08 '25 18:06 platypii

Sorry, but the old web UI is no longer possible, and needs to be decommissioned.

for these changes, only Node will be possible.

unless @hrgdavor has a solution for a small web server.

z3dev avatar Jun 08 '25 21:06 z3dev

@platypii I will try a fresh install, and maybe see If I could get web running. what command did you use to start web server ?

I am bad at reviewing stuff, but maybe I can help you to be able to review.

hrgdavor avatar Jun 09 '25 07:06 hrgdavor

Fresh install is not going to help. The old Web UI cannot be used anymore; old unsupported components, horrible web workers, and no support for ES packages.

I think we need a new DEV web server, built upon the standard Node web server and JSCAD UI components. Nothing fancy. For testing only. How possible is that?

z3dev avatar Jun 09 '25 11:06 z3dev

Of course, NODEJS still works.

z3dev avatar Jun 09 '25 11:06 z3dev

perf01

z3dev avatar Aug 15 '25 23:08 z3dev

@platypii sorry... a few late changes. please take another look.

i learned a few tricks

https://expertbeacon.com/why-a-ternary-operator-is-not-a-conditional-operator-in-javascript/

z3dev avatar Aug 16 '25 00:08 z3dev