You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During coding for #812 to create native Buffers and improve speed of converting geometries for rendering few issues were discovered
Sample object was a sphere with segments=500
post message took ~2000 ms
new code generating buffers took ~170ms (entitiesFromSolids)
old code generating buffers took ~170ms to generate data (entitiesFromSolids)
render after that took another second in both cases (could not measure exactly the time to see it on screen)
total ~ 3000+ ms
and when you add the overhead of killing and starting worker on parameter change
total ~ 5000+ ms
my jscad prototype with threejs renderer does all of this in ~100 +~40ms (from changing param to seing result on the screen)
total ~ 140ms
This is a huge difference, and does look scary, but is also a pointer how much better it can be in the future
1) Worker postMessage huge arrays kills performance without transferables
so the first and biggest performance killer is transferring via postMessage and that will require native buffer generation to be moved to worker so those buffers can be added to transferable array and reduce postMessage overhead to ~zero,
2) generate render data and color per vertex
Forcing generation of color data for each vertex even though in v2 colored vertices are not used slows down render data generation slightly. This one is really least important and is miniscule compared to the rest.
3) regl is slow to upload to gpu even with native buffers prepared
Just generating those buffers did not improve eprformance of getting data into gpu
might be some more steps need to be done so regl uses this perfomantly (maybe my fault)
or could be that this is a fault in regl library itself
4) restarting the worker slows everything even more
Killing and starting new worker is very expensive. this part will be resolved if website is redone without most library and we have more control over the worker
regl issue but not a big perf issue hopefuly
setting webgl2 causes issue that then regl does not allow for uint32 for indices due to missing extension, so it will likely take more tinkering to get uint32 indices working together with webgl2.
next steps
I would like to move the code that generates buffers to worker so transferable can be utilized. This should bring big performance gain in part 1) .
And would also allow to start using other renderers alongside regl (threjs, babylon) and an oportunity to define small set of functionalities such renderer must support to be used interchangeably.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
intro
During coding for #812 to create native Buffers and improve speed of converting geometries for rendering few issues were discovered
Sample object was a sphere with
segments=500
total ~ 3000+ ms
and when you add the overhead of killing and starting worker on parameter change
total ~ 5000+ ms
my jscad prototype with threejs renderer does all of this in ~100 +~40ms (from changing param to seing result on the screen)
total ~ 140ms
This is a huge difference, and does look scary, but is also a pointer how much better it can be in the future
1) Worker postMessage huge arrays kills performance without transferables
so the first and biggest performance killer is transferring via postMessage and that will require native buffer generation to be moved to worker so those buffers can be added to transferable array and reduce postMessage overhead to ~zero,
2) generate render data and color per vertex
Forcing generation of color data for each vertex even though in v2 colored vertices are not used slows down render data generation slightly. This one is really least important and is miniscule compared to the rest.
3) regl is slow to upload to gpu even with native buffers prepared
Just generating those buffers did not improve eprformance of getting data into gpu
4) restarting the worker slows everything even more
Killing and starting new worker is very expensive. this part will be resolved if website is redone without most library and we have more control over the worker
regl issue but not a big perf issue hopefuly
setting webgl2 causes issue that then regl does not allow for uint32 for indices due to missing extension, so it will likely take more tinkering to get uint32 indices working together with webgl2.
next steps
I would like to move the code that generates buffers to worker so transferable can be utilized. This should bring big performance gain in part 1) .
And would also allow to start using other renderers alongside regl (threjs, babylon) and an oportunity to define small set of functionalities such renderer must support to be used interchangeably.
Beta Was this translation helpful? Give feedback.
All reactions