Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not as optimized for Browserify as it could be. #29

Closed
aickin opened this issue Oct 24, 2016 · 3 comments
Closed

Not as optimized for Browserify as it could be. #29

aickin opened this issue Oct 24, 2016 · 3 comments

Comments

@aickin
Copy link
Collaborator

aickin commented Oct 24, 2016

In the vein of #7, I think optimize-js also doesn't work optimally for Browserify.

Whereas Webpack wraps modules in function expressions that are elements in an array, Browserify wraps modules in function expressions that are elements in an array which is in turn a value in an object with numeric keys, something like this:

!function(o){
  /* loader code */
}({
  1:[function(o,r){/*module 1 code */}, {}],
  2:[function(o,r){/*module 2 code */}, {}],
  3:[function(o,r){/*module 3 code */}, {}]
}

I noticed in making my patch for #7 and testing on The Cost of Small Modules benchmark repo that optimize-js had essentially no effect on the Browserify bundles, and I'm pretty sure this is why.

@nolanlawson
Copy link
Owner

Good insight! I 100% failed to notice this. Luckily if we modify the code to fix this, then some of the benchmark code should already run faster, since I know a few of them are build with Browserify (e.g. PouchDB is).

nolanlawson pushed a commit that referenced this issue Nov 2, 2016
* Fix for #7: Not as optimized for Webpack as it could be. Adds ability to wrap functions that are elements of an array literal in an argument list

* Added a few negative case tests in response to code review.

* Modified the array literal logic to very specifically track with webpack patterns rather than all array literal function parameters.

* Added optimization of browserify modules.

* Refactor of browserify and webpack logic.
@davidmarkclements
Copy link

Should this be closed due to #36?

@nolanlawson
Copy link
Owner

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants