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

Multiple passes? #61

Open
boopathi opened this issue Jul 29, 2016 · 6 comments
Open

Multiple passes? #61

boopathi opened this issue Jul 29, 2016 · 6 comments

Comments

@boopathi
Copy link
Member

Are there situations that we might need multiple passes for better minification ?

For example, one plugin might transform

if (a) foo (x) : foo (y);
//to
a ? foo (x) : foo (y)

and another plugin might transform

//to
foo (a ? x : y);

// or even,
x ? foo(a) : foo(b)
//to
foo (x ? a : b)

and another one could remove this as pure expression statement. or modify it differently. I'm not able to think about it.

So the order of plugins in the preset will matter, and we say (with plugins- a and b) the order is a, b, and another particular transformation might require the order to be b, a. So, should we explore multiple passes. I'm not sure if this is a problem. Just asking if there are situations that you faced like this.

@fregante
Copy link
Contributor

fregante commented Jul 29, 2016

This is definitely a problem in a lot of other optimization software I used and babel-minify is no exception; I listed a couple of already-existing sorting issues here: #25 (comment) (the last two points at the end of Edit 2)

@boopathi
Copy link
Member Author

boopathi commented Dec 5, 2016

#317 Simplify and DCE order

@kangax
Copy link
Member

kangax commented Dec 5, 2016

A brute force solution would be to add a preset option that simply does 2 passes. When I tested this a while ago I also saw that sometimes 3 passes can increase size even more. Not sure how to deal with this. How to strike balance between transformation time and size, where a tiny improvement can cause 2x or 3x longer times.

@boopathi
Copy link
Member Author

boopathi commented Dec 5, 2016

3 passes can increase size even more

this should be the mangler

@boopathi
Copy link
Member Author

#422 Simplify after DCE

@boopathi boopathi added this to the 1.0 milestone Apr 6, 2017
@vigneshshanmugam
Copy link
Member

lets take advantage of the plugin ordering option babel/babel#5735

@boopathi boopathi removed this from the 1.0 milestone Nov 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants