Conversation
|
Is there any indication that this is faster than the non web-worker execution? |
|
Faster at running the simulations? Probably not. I didn't measure, but I didn't notice a meaningful difference. If anything I would expect the simulations to be slightly slower given IO and some amount of duplicated work. The webworker can't run the blocking simulation any faster than the main browser thread. Faster at producing a responsive page? Yes. Before analysis page I was testing with froze for ~5s after loading until all the simulations were completed, now the page becomes responsive immediately. I think we still spending ~100ms to kick all this off from the main thread, but I think that's acceptable. Unfortunately the analysis Tim shared with me for testing is not public: http://localhost:5173/analysis/019cafd4-19fb-7b62-9e11-ceda2da5da67 There is another major benefit beyond speed: This also allows you to change parameters while the simulation is running, cancelling the previous run. Before it was relatively easy to cause a simulation to permanently freeze a page (exponential O(n) in the simulation). |
kasbah
left a comment
There was a problem hiding this comment.
It does indeed improve loading Tim's big model ™ . Suggestions and questions below.
Right, to build on Jason's response, this isn't about making the simulations faster per se but making the rest of the application be more responsive while simulations run. If you really want to stress test this feature, try to doing a loop finding analysis into a large causal loop diagram, with a high upper limit on the lengths of the paths considered. Because the homomorphism finding has combinatorial complexity, this blows up quickly. In fact, I had to make the fix #419 a while back because the whole browser would freeze if you didn't impose a limit on the path length. |
# Conflicts: # packages/frontend/src/stdlib/analyses.tsx # packages/frontend/src/stdlib/analyses/mass_action.tsx # packages/frontend/src/stdlib/analyses/simulator_types.ts # packages/frontend/src/stdlib/theories/petri-net.ts # packages/frontend/src/stdlib/theories/primitive-signed-stock-flow.ts # packages/frontend/src/stdlib/theories/primitive-stock-flow.ts
1413fc1 to
74a9320
Compare
|
Needs a rebase/merge and would be good to get @epatters eyes on this too. |
|
Yep, I'm planning to review this one too. |
No description provided.