Matt Krick
1 min readApr 11, 2016

--

Really great stuff, thank you! A quick question about the crankshaft compiler: Let’s say 50% of the time I call a doMath function and the inputs are Ints, and the rest of the time the inputs are Doubles. A language like Julia would figure out sometimes its called with Ints, make a monomorphic function, and then when it’s called with Doubles, create another one. Then, based on the inputs, call the correct function. I noticed in JS it’ll just deoptimize & maybe optimize again later, if I’m lucky. Is there a reason the engine doesn’t make 2 distinct optimized functions? Would that be possible in the future, or has there been any benchmarking that showed it wasn’t worth it?

--

--

Matt Krick
Matt Krick

Responses (1)