CSharpCAD vs JSCAD Performance Numbers #1101
Replies: 4 comments 5 replies
-
Are there tests comparing OpenSCAD and JSCAD performance? |
Beta Was this translation helpful? Give feedback.
-
Very interesting data, thanks @briansturgill. That's not terrible performance, considering it's JavaScript. But I'm not done optimizing yet 😃 |
Beta Was this translation helpful? Give feedback.
-
Node has gotten a fair bit faster since version 12, I've seen our tests get faster with newer node version. I'd be curious how the numbers compare on a newer node version, and the |
Beta Was this translation helpful? Give feedback.
-
OK, the test have finished under node 18.2.0 -- generally somewhat faster. |
Beta Was this translation helpful? Give feedback.
-
I translated the JSCAD performance tests to CSharpCAD and ran timing tests on the same system.
Attached are three items, jscad_perf.txt, cscad_perf.txt, and myperf.js.
I ran the myperf.js command as: node myperf.js
The suggested node flags for GC in the Performance Tests README are no longer valid.
I used node version: v12.22.9 (current under Ubuntu MATE).
Myperf.js is a rewrite of the the performanceV3.js -- The microtime module used was either faulty, or systems have gotten too fast to use it.
Also, I didn't like it scaling the numbers down to 0.000000..... Hard to read, I had to keep counting zeros.
The myperf.js output is in the number of milliseconds it took to run the test 1000 times.
The same sort of mechanism was used in the C# test harness.
The tests were run on CSCAD and JSCAD with NEITHER OF THEM having the optimizations to Poly3.MeasureBoundingBox/Sphere and Math.hypot that I've brought up in new issues recently.
SUMMARY:
As C# is a compiled language, its not surprising that CSharpCAD runs everything, generally speaking, 2x+ faster than JSCAD.
JSCAD runs things faster only in very short running code... I suspect the JSCAD Jitter is lighter weight than the C# Jitter.
For CPU intensive items, CSCAD runs booleans operations about 1.8 times faster than JSCAD... however once the discussed optimizations to Poly3.measureBoundBox... etc. are made, I'm expecting that difference might only be 1.5 times faster as JSCAD is particularly hindered here by the slowness of Math.hypot under nodeJS.
Otherwise, it's CSCAD all the way with extrusions and hulls runnning 4x+ faster (a large extrudeRectangular is 10x faster!).
myperf.js
cscad_perf.txt
jscad_perf.txt
Beta Was this translation helpful? Give feedback.
All reactions