feat(moduletemplate): Wrap function module template wrappers with parens#3658
Conversation
Back-ports c7b06ad (webpack#3658) to webpack-1 based on https://twitter.com/TheLarkInn/status/815230804729196544.
|
Cool! Have you measured the impact of any bundle sizes to see what the load time improvement might be? Note that JS engines are changing all the time, and the impact can vary from codebase to codebase (even have a negative impact in some cases!), so it's good to actually be measuring this stuff. In |
|
Is there anywhere we can get an ELI5 (explain like I'm 5) explanation for this? I don't quite understand why this causes such a performance improvement? |
|
@citypaul This description specifically addresses the performance improvement https://gist.github.com/getify/938c4a46013244cbd3cd750c0bc767ce |
|
@nolanlawson, we ourselves don't have large enough example repos to warrent measurable results, we have had folks like @MikaAK who has used the separate plugin I wrote emulating this behavior. We would love to collect a list off large applications so we can do further perf analysis. Hard to get hands on in an easy way. |
|
@gavinwahl Thanks for that gist. That's exactly what I was looking for 👍 |
@TheLarkInn A large real-world repo with webpack is |
|
Thank you @statianzo! Have you tested out a build against webpack in master? I'm interesting to see the gains. Will probably test it myself anyways. |
|
@TheLarkInn I've been doing some internal tests at Domo with @aaronfrost using the |
|
Much appreciated! |
What kind of change does this PR introduce?
Feature
Did you add tests for your changes?
N/A
If relevant, link to documentation update:
Summary
All browser engines currently can be signaled to lazy parse code by wrapping iife's with parents. After speaking with @fhinkel and a few other members of the V8 team, we were recommended that we use this heuristic technique. The change is very minimal in that in converts the output template to go from:
to
Overall findings by @nolanlawson state that load and performance gains of over 10%-50% depending on browser engine. https://github.com/nolanlawson/optimize-js#benchmark-overview
Does this PR introduce a breaking change?
No.
Other information