Anonymous function for supportAEL isn't required #1

Merged
merged 1 commit into from Feb 9, 2012

Conversation

Projects
None yet
2 participants
Contributor

Daniel15 commented Feb 8, 2012

Use "not not" (cast to boolean)

Integralist added a commit that referenced this pull request Feb 9, 2012

Merge pull request #1 from Daniel15/patch-1
Replace immediately invoked function expression with a boolean coercion

@Integralist Integralist merged commit 502ec20 into Integralist:master Feb 9, 2012

Owner

Integralist commented Feb 9, 2012

@Daniel15 thanks Daniel for flagging this up. Using the boolean coercion is a lot cleaner syntax in my opinion but I wasn't sure if it would be worse performing than a one time function execution. So I set-up a performance test case first just to be sure (http://jsperf.com/one-time-iife-or-everytime-boolean-conversion) and it was a resounding performance optimisation increase which is always nice :-)

Contributor

Daniel15 commented Feb 9, 2012

Yeah, I didn't benchmark it myself but I'd imagine that the overhead of a function call is far greater than type coercion. Function calls are relatively expensive compared to a lot of other operations. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment