3 ms·
I don't think that would go far enough. Consider: even if all the functions returned something, a clever compiler might inline the hot function calls, and might
by fenomas 11y ago
I don't think that would go far enough. Consider: even if all the functions returned something, a clever compiler might inline the hot function calls, and might then see that most of the argument checks are unnecessary, and eliminate them. Which would mean it's gotten rid of precisely the code that's being benchmarked!
In short, writing JS microbenchmarks that actually test what they claim to test is quite hard.