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

Feature: Reuse of expressions (ie. long strings) #2385

Closed
moshest opened this issue Oct 21, 2017 · 2 comments
Closed

Feature: Reuse of expressions (ie. long strings) #2385

moshest opened this issue Oct 21, 2017 · 2 comments

Comments

@moshest
Copy link

moshest commented Oct 21, 2017

Consider the following function:

function foo() {
  return {
    a: "long long string", 
    b: "long long string"
  };
}

Uglify minify it to:

function foo(){return{a:"long long string",b:"long long string"}}

But a better compression will be:

function foo(){var r="long long string";return{a:r,b:r}}

There is a reason this feature is not supported?

@moshest moshest changed the title Feature: reuse of variables and long strings Feature: Reuse of variables and long strings Oct 21, 2017
@moshest moshest changed the title Feature: Reuse of variables and long strings Feature: Reuse of expressions (ie. long strings) Oct 21, 2017
@kzc
Copy link
Contributor

kzc commented Oct 21, 2017

This feature has been requested a few times over the years but interning strings does not generally produce better gzip results after minification for real life code.

@alexlamsl
Copy link
Collaborator

Closing as duplicate of many similar issues, e.g. #75

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