The Black Cat of Microbenchmarks
mrale.ph
mrale.ph
A few years ago I hand-tuned some kdb+/q interop code on Crankshaft using IRHydra2 and d8. The results were impressive: about 10x by just shuffling code around to be friendlier to the JIT. It was fun, but more than a little mysterious.
Tuning on Crankshaft was all about avoiding bailout (https://github.com/vhf/v8-bailout-reasons/blob/master/README...). Tuning for Turbofan is less about "gotchas" and more about making sure your functions don't go megamorphic. Using TypeScript or Flow helps you do this just to get your code to typecheck anyway so it's a good habit.
As mentioned in this comment (https://news.ycombinator.com/item?id=15067462) there is still some minor analysis of the IR possible in IRHydra2 on TurboFan.
TurboFan IR (and Turbofan in general) is way simpler and more readable than Crankshaft. Figuring out what's optimized and how is easy with the CodeStubAssembler. I remember nights of head-scratching with CrankShaft :D
How can you disable dead-code elimination in a graphical IR? I would have thought it was implicit?
So apparently it's been turned on for a while now which is good (it was off for a while before that).
I generally code with an attitude of "a sufficiently-smart-optimizer should understand this", but it's clear that in a lot of cases writing ugly code can be more performant.
I would actually be more interested in highlighting opportunities for engine improvement over just making a particular piece of my code faster.