Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upMove functions F2-F9 & A2-A9 outside conditional #497
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
evancz
Apr 28, 2016
Member
I'm not sure. It is going to just work different in the next release such that Closure Compiler has a much easier time with things. I've also verified that everything works with simple optimizations in the new version of things.
|
I'm not sure. It is going to just work different in the next release such that Closure Compiler has a much easier time with things. I've also verified that everything works with simple optimizations in the new version of things. |
evancz
closed this
Apr 28, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
robertjlooby commentedFeb 2, 2016
Using a function statement inside a conditional is non-standard (most browers other than Firefox will declare the function anyways). Since the only point of having these inside the conditional seems to be to prevent them from being redefined to the same thing if
Runtime.jsis included twice on the same page, it seems safe to move them out from the conditional.The benefit to doing this is that it allows the Closure Compiler to be used on the generated
elm.js(at least inWHITESPACE_ONLYand possibly onSIMPLE_OPTIMIZATIONS). A simple "Hello World" app:When compiled is 147K.
Minimized on
WHITESPACE_ONLYit is 96K (and works fine).Minimized on
SIMPLE_OPTIMIZATIONSis 61K (and works fine).On a somewhat larger project of mine that compiles to 562K, making this change also allows
WHITESPACE_ONLYcompilation to 292K (works) andSIMPLE_OPTIMIZATIONScompilation to 202K (also works).It's possible there's something I'm missing, but I don't think there's any downside to moving these outside the conditional.