@jaffathecake Is there a reason code executed on the global scope is slower than the same code in a function called from the global scope. Same behaviour in other browsers bar Safari?
-
-
Well `var x` on global scope is a property of the global object whereas `var x` in a function is a stack local (or worst case context local). Accessing object properties is obviously slower than accessing stack slots.
-
*goes and wraps entire codebase in IIFE*
- 2 more replies
New conversation -
-
-
Test case?
-
Working on it...
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.