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

handle circular function reference gracefully #2446

Merged
merged 1 commit into from
Nov 6, 2017

Conversation

alexlamsl
Copy link
Collaborator

fixes #2442

/cc @kzc

@alexlamsl
Copy link
Collaborator Author

@kzc I'm trying to come up with a test that resembles real code - for instance, this works just fine without this PR:

console.log(function factorial(n) {
    return n ? n * factorial(n - 1) : 1;
}(10));

@kzc
Copy link
Contributor

kzc commented Nov 6, 2017

I don't think it's possible to come up with an example of single-use function cycles in non-dead code.

@alexlamsl
Copy link
Collaborator Author

FWIW I've managed to sneak in just under 1MFuzz on current master, so once this gets merged I'll go spend ~30 minutes of ufuzz.js, then if nothing happens cut uglify-js@3.1.8

@alexlamsl alexlamsl merged commit bbedbf4 into mishoo:master Nov 6, 2017
@alexlamsl alexlamsl deleted the issue-2442 branch November 6, 2017 18:37
@alexlamsl
Copy link
Collaborator Author

110kFuzz passed without incident.

node test/benchmark.js

v3.1.7 bbedbf4
https://code.jquery.com/jquery-3.2.1.js
- parse: 0.218s
- scope: 0.173s
- compress: 1.015s
- mangle: 0.125s
- properties: 0.000s
- output: 0.125s
- total: 1.656s

Original: 268039 bytes
Uglified: 86649 bytes
GZipped:  30303 bytes
SHA1 sum: 6c6d35d1d0bb687f154f92c244b92732f757cc0e

https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular.js
- parse: 0.421s
- scope: 0.250s
- compress: 1.922s
- mangle: 0.266s
- properties: 0.000s
- output: 0.141s
- total: 3.000s

Original: 1249863 bytes
Uglified: 173799 bytes
GZipped:  60312 bytes
SHA1 sum: 5019b726d625a60b04c70970f0a7219fb0c16eb8

https://cdnjs.cloudflare.com/ajax/libs/mathjs/3.9.0/math.js
- parse: 0.796s
- scope: 0.391s
- compress: 3.500s
- mangle: 0.344s
- properties: 0.000s
- output: 0.312s
- total: 5.343s

Original: 1590107 bytes
Uglified: 467114 bytes
GZipped:  118668 bytes
SHA1 sum: 148315009a072f17e11a100f7b1f66834a44d97f

https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js
- parse: 0.093s
- scope: 0.062s
- compress: 0.360s
- mangle: 0.078s
- properties: 0.000s
- output: 0.047s
- total: 0.640s

Original: 69707 bytes
Uglified: 36833 bytes
GZipped:  9683 bytes
SHA1 sum: bf8c46ddfb05ad98cd4e148038849b5bf2de3fe8

https://unpkg.com/react@15.3.2/dist/react.js
- parse: 0.453s
- scope: 0.265s
- compress: 1.516s
- mangle: 0.281s
- properties: 0.000s
- output: 0.156s
- total: 2.671s

Original: 701412 bytes
Uglified: 205401 bytes
GZipped:  61961 bytes
SHA1 sum: df7f3652caa67e76f7c2c29679c296580dcd7254

http://builds.emberjs.com/tags/v2.11.0/ember.prod.js
- parse: 0.750s
- scope: 0.516s
- compress: 2.734s
- mangle: 0.343s
- properties: 0.000s
- output: 0.297s
- total: 4.640s

Original: 1852178 bytes
Uglified: 526197 bytes
GZipped:  128344 bytes
SHA1 sum: 709c512d932fa559b4fa658b2c06ac543ec4e550

https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js
- parse: 0.265s
- scope: 0.188s
- compress: 1.547s
- mangle: 0.109s
- properties: 0.000s
- output: 0.141s
- total: 2.250s

Original: 539590 bytes
Uglified: 69910 bytes
GZipped:  24405 bytes
SHA1 sum: aff3d8636e0551decdac2733b14de75b4162303e

https://cdnjs.cloudflare.com/ajax/libs/d3/4.5.0/d3.js
- parse: 0.531s
- scope: 0.328s
- compress: 2.359s
- mangle: 0.250s
- properties: 0.000s
- output: 0.172s
- total: 3.640s

Original: 451131 bytes
Uglified: 211001 bytes
GZipped:  70248 bytes
SHA1 sum: 746cbefc1bb57d73f2f31d642f4fda32ea8e9f15
https://code.jquery.com/jquery-3.2.1.js
- parse: 0.250s
- compress: 1.125s
- scope: 0.078s
- mangle: 0.140s
- properties: 0.000s
- output: 0.141s
- total: 1.734s

Original: 268039 bytes
Uglified: 86653 bytes
GZipped:  30303 bytes
SHA1 sum: 6e93d7851761a6c473e32a92f8247d8310e294e5

https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular.js
- parse: 0.453s
- compress: 2.172s
- scope: 0.078s
- mangle: 0.234s
- properties: 0.000s
- output: 0.141s
- total: 3.078s

Original: 1249863 bytes
Uglified: 173819 bytes
GZipped:  60320 bytes
SHA1 sum: 7ef60c3a68facf60a73679aa66fcb13c0a556e1f

https://cdnjs.cloudflare.com/ajax/libs/mathjs/3.9.0/math.js
- parse: 0.828s
- compress: 3.859s
- scope: 0.172s
- mangle: 0.359s
- properties: 0.000s
- output: 0.313s
- total: 5.531s

Original: 1590107 bytes
Uglified: 467118 bytes
GZipped:  118675 bytes
SHA1 sum: 3a633e675e5471d44eecb5de5e09e5d2b8c1f9ac

https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js
- parse: 0.093s
- compress: 0.407s
- scope: 0.015s
- mangle: 0.063s
- properties: 0.000s
- output: 0.047s
- total: 0.625s

Original: 69707 bytes
Uglified: 36833 bytes
GZipped:  9683 bytes
SHA1 sum: bf8c46ddfb05ad98cd4e148038849b5bf2de3fe8

https://unpkg.com/react@15.3.2/dist/react.js
- parse: 0.375s
- compress: 1.687s
- scope: 0.078s
- mangle: 0.172s
- properties: 0.000s
- output: 0.141s
- total: 2.453s

Original: 701412 bytes
Uglified: 205436 bytes
GZipped:  61964 bytes
SHA1 sum: 5e1628192cdd3a963c849eba6340ba457cc20e9b

http://builds.emberjs.com/tags/v2.11.0/ember.prod.js
- parse: 0.828s
- compress: 3.000s
- scope: 0.187s
- mangle: 0.344s
- properties: 0.000s
- output: 0.312s
- total: 4.671s

Original: 1852178 bytes
Uglified: 526314 bytes
GZipped:  128389 bytes
SHA1 sum: f7f1873ca3cc0133533d35a02d4c44dc6a6bbe4b

https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js
- parse: 0.250s
- compress: 1.812s
- scope: 0.078s
- mangle: 0.141s
- properties: 0.000s
- output: 0.156s
- total: 2.437s

Original: 539590 bytes
Uglified: 69889 bytes
GZipped:  24396 bytes
SHA1 sum: c1d197ecbbadf69ac46509041b54ae6bfc5401b5

https://cdnjs.cloudflare.com/ajax/libs/d3/4.5.0/d3.js
- parse: 0.500s
- compress: 2.671s
- scope: 0.110s
- mangle: 0.234s
- properties: 0.000s
- output: 0.172s
- total: 3.687s

Original: 451131 bytes
Uglified: 210981 bytes
GZipped:  70248 bytes
SHA1 sum: 13b467b580fdff34806c5604a7de9f008d2b8149

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

Successfully merging this pull request may close these issues.

infinite deep clone in function inlining
2 participants