Function inlining is absolutely automatic in modern JS runtimes. Of course, that doesn't mean the functions you want inlined will get inlined, so it can still occasionally pay off to do it by hand - but make sure you test to see if the results are actually better. Sometimes the runtime will decide not to inline a function for a good reason. For example, if the function you're calling has something wrong with it that deoptimizes it in the JS runtime, inlining that function will successfully deoptimize the outer function. Now more of your code is running slowly.<p>EDIT: If you're micro-optimizing, why not cache '((hitColor >> 24) & 0xFF)' in a local at the top of the function instead of computing it every iteration? Loop invariant code motion might hoist it for you, but I don't know why you wouldn't do that by hand.<p>Also, wrapping your integer arithmetic in ( ) | 0 may improve its performance in Firefox and some other browsers because it allows the JIT to omit overflow checks. Should help since you're doing a lot of addition to index into arrays.