In this test, I am looking at two different ways of function expressions; using the exclamation point unary operator and using brackets.
The following are the 2 tests:
var f = !function() {};
var f = (function() {});
Given the results below, I was intrigued when I saw that the unary operator test was ~5261% faster than the brackets test in Firefox.


What sort of optimization is going on that amounts to such a significant increase in performance in Firefox, dwarfing the other browsers?
The first one is resulting in a
boolean, and the second one afunction. There doesn’t seem to be much real-world significance to your test.I suppose Firefox has an optimization that avoids creation of the function object since it is never actually used, but that’s just a guess.
Here’s an updated jsPerf. This one adds two tests that create boolean values. Notice that they’re very close to the “Exclamation” test in Firefox.
This lends support to the idea that Firefox has this particular optimization.