`a = 0-x` is about 3-10x faster than `a = -x` 🤯
Let's jump into JavaScript VM details to see why and how to guard against this VM de-opt:
🧵🪡🧶
Miško Hevery (AngularJS/Angular/Qwik)
5,734 posts
- JSX could have been 2x faster if it was designed more optimally for JS VMs! Let's see what design decisions make JSX slow and how we could speed it up. 🧵🪡🧶
- How can `a+b` be almost 4x faster than `b+a`? 🤯 1/6
- useSignal() is the future of web frameworks and is a better abstraction than useState(), which is showing its age. 🧵🪡🧶
- Make your code faster with Bloom filters. They are like HashMaps but smaller and allow you to short-circuit more expensive operations. 🧵🪡🧶
- useEffect is a bad abstraction There is a better way: 🧵🪡🧶
- Did you know that without 0x5F3759DF (magic number) Qake (the game) would not have been possible? The fast inverse square root is 🤯 code popularized by Quake, which at first sight looks like complete nonsense. Google: 0x5F3759DF 🧵🪡🧶
- Strongly prefer `===` over `==`! `==` is complex to reason about and can be up to 15x slower then `===` 1/5
- Understanding monomorphism can improve your JavaScript performance 60x. Curios to find out more, read this thread.
- React’s upcoming compiler will not solve prop-drilling, but Signals solve it well. 🧵🪡🧶
- Amdahl's law: the nightmare of a perf engineer! "The overall performance improvement gained by optimizing a single part of a system is limited by the fraction of time that the improved part is actually used"
- After 15 years at Google and 10 years on @angular I am excited to announce that I am moving onto the next chapter in my professional life. I will be joining @builderio as their CTO to help empower anyone to create blazing fast sites, with some very exciting updates coming soon.
- Lazy loading in frameworks is a lie! (And then we blame the developer for slow sites.) 🧵🪡🧶
- It's best to name your variables positively. Negative variables take longer to process in your brain because they can be part of negated expressions, creating double negatives.













