(no title)
iamakulov | 3 years ago
- This was a v fun (and challenging, due to Causal's scale!) project to do
- Most optimizations we’ve implemented were (very effective) one-off fixes. But we were also glad to find some rules of thumb that help to keep the app faster by default [1]
- My most interesting discovery was how ineffective Web Workers are. Causal, sometimes, has to do some expensive client-side data parsing. We tried to move data parsing to a web worker (= a separate thread) – but ended up reverting the optimization because it made the app slower. In JS, you can’t just pass a pointer to a data structure between threads; the browser has to clone the data structure [2] (with limited exceptions [3]). In our case, cloning the data between threads ended up being several times slower than parsing it in the main thread.
[1] https://www.causal.app/blog/react-perf#span-class=inline-cod...
[2] https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers...
[3] https://developer.mozilla.org/en-US/docs/Glossary/Transferab...
No comments yet.