Why do people worry so much about function allocations but don’t worry about dynamic dispatch? There are so many pattern where this.something causes deopts, especially if you compile classes and class properties with Babel.
-
Show this thread
-
I’m not saying anyone should pivot to worry about those instead. But it’s interesting that the gut reaction of “functions have to be slower” (they’re not) completely misses that there are many deopts we can avoid now.
1 reply 1 retweet 17 likesShow this thread -
If you look at function() {} and think “oh this must be expensive”, and then look at http://this.foo and think “accessing this is free” you might want to check your guesses. (In a real app, not a benchmark — benchmarks don’t represent what happens with real components.)
4 replies 13 retweets 70 likesShow this thread
Sebastian Retweeted Sebastian
Real-world example: I made the Babel parser 25% faster by converting a deep Parser class hierarchy to functions. Caused the engine to inline more and didn't need expensive dynamic dispatchhttps://twitter.com/sebmck/status/951299423622975489 …
Sebastian added,
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 