-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix inline
handling of AST_Call.args
#2059
Conversation
Looks like the fuzzer's handiwork - how many iterations so far? |
Only at the starting point of The Million Fuzz, as the box recovers from summer heat. This one got hit ~1kFuzz - and after merge and restart we are currently at 30kFuzz and counting. |
Not a scientific measurement, but a crude test shows |
Can you show the timings with and without the node 8 |
$ node -v
v8.0.0
$ node bin/uglifyjs -V
uglify-js 3.0.15
$ node bin/uglifyjs math.js -mco min.js --timings
- parse: 0.531s
- scope: 0.391s
- compress: 8.812s
- mangle: 0.500s
- properties: 0.000s
- output: 0.328s
- total: 10.562s
$ node --turbo bin/uglifyjs math.js -mco min.js --timings
- parse: 0.609s
- scope: 0.390s
- compress: 7.719s
- mangle: 0.438s
- properties: 0.000s
- output: 0.297s
- total: 9.453s |
|
Following the flag around this file might give some clues: https://github.com/v8/v8/blob/45618a9ab5cc98a5de200b0116670e8c272f0c5f/src/flag-definitions.h#L463 |
According to the V8 blog, Ignition (interpreter) and TurboFan (optimizing compiler) are the default now. So I'm guessing that |
Ignition seems to be off by default: and |
Obviously Google Chrome can be compiled with a modified set of default values, which may be what's mentioned in the blog post you've quoted. |
So what timings do you get for node 8 with |
$ node --no-turbo --no-ignition bin/uglifyjs math.js -mco min.js --timings
- parse: 0.531s
- scope: 0.390s
- compress: 8.641s
- mangle: 0.485s
- properties: 0.000s
- output: 0.343s
- total: 10.390s |
It's still not clear to me what |
Judging by the numbers, I'd say Ignition is off by default, i.e. same as OT: just hit 200kFuzz |
Obviously none of us are authoritative on this query, but can we safely assume that whatever combination of flags make Just want to be sure I didn't overlook anything here. |
So on node 7
Is the same true for node 8? |
Under "Say hello to
So I think those new stuff aren't enabled by default in Node.js 8 yet. |
Ignition doesn't seem to slow things down over here: $ nvs use node
node/8.0.0/x64
$ node bin/uglifyjs math.js -mco min.js --timings
- parse: 0.546s
- scope: 0.391s
- compress: 8.828s
- mangle: 0.500s
- properties: 0.000s
- output: 0.344s
- total: 10.609s
$ node --no-turbo --no-ignition bin/uglifyjs math.js -mco min.js --timings
- parse: 0.546s
- scope: 0.391s
- compress: 8.578s
- mangle: 0.485s
- properties: 0.000s
- output: 0.328s
- total: 10.328s
$ node --no-turbo --ignition bin/uglifyjs math.js -mco min.js --timings
- parse: 0.578s
- scope: 0.421s
- compress: 9.094s
- mangle: 0.516s
- properties: 0.000s
- output: 0.359s
- total: 10.968s
$ node --turbo --no-ignition bin/uglifyjs math.js -mco min.js --timings
- parse: 0.625s
- scope: 0.390s
- compress: 7.750s
- mangle: 0.422s
- properties: 0.000s
- output: 0.313s
- total: 9.500s
$ node --turbo --ignition bin/uglifyjs math.js -mco min.js --timings
- parse: 0.625s
- scope: 0.391s
- compress: 7.765s
- mangle: 0.437s
- properties: 0.000s
- output: 0.297s
- total: 9.515s |
Confirmed that node 8.0.0 with
node 8.0.0 achieves this speed by using a background thread - note the higher user CPU time compared to node 0.10. Also note how the shasums differ after node 0.12 with latest master - what's up with that? --- math.010.js 2017-06-06 13:34:39.000000000 -0400
+++ math.800.js 2017-06-06 13:34:23.000000000 -0400
@@ -8170 +8170 @@
- if ("%" === e) return "%";
+ if ("%%" === e) return "%"; Original code: if (x === '%%') return '%'; Is there a bug in latest master when running on node 0.10 and node 0.12? |
Good to know the performance difference is OS-independent.
Interesting - investigating now. |
|
simpler test case:
|
May be related to $ node -v
v0.10.48
$ git checkout v2.8.28
$ echo 'function f(x){if(x==="%%")return"%"}console.log(f("%%"))' | node bin/uglifyjs -c
function f(x){if("%%"===x)return"%"}console.log(f("%%"));
$ git checkout v3.0.0
$ echo 'function f(x){if(x==="%%")return"%"}console.log(f("%%"))' | node bin/uglifyjs -c
function f(x){if("%"===x)return"%"}console.log(f("%")); |
|
Quick debug on --- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -173,6 +173,7 @@ if (program.self) {
var chunks = [];
process.stdin.setEncoding("utf8");
process.stdin.on("data", function(chunk) {
+console.error(chunk);
chunks.push(chunk);
}).on("end", function() {
files = [ chunks.join("") ]; So is there any known issues with reading from $ node -v
v0.10.48
$ echo 'x("%%")' | node bin/uglifyjs -c
x("%")
x("%");
$ node -v
v4.8.3
$ echo 'x("%%")' | node bin/uglifyjs -c
x("%%")
x("%%"); |
It's broken in parse:
|
Well, it's broken before that - see #2059 (comment) where I literally print out what I read from |
2.x uses different node I/O calls? |
The only difference I can tell is the use of But I just tried that on |
Not specific to stdin:
|
Of course you are correct - what was I thinking... 😞 Okay this is getting funky... --- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -189,6 +189,8 @@ function run() {
UglifyJS.AST_Node.warn_function = function(msg) {
console.error("WARN:", msg);
};
+console.log(files);
+console.log(files[0]);
if (program.timings) options.timings = true;
try {
if (program.parse) { $ node -v
v0.10.48
$ echo 'x("%%")' | node bin/uglifyjs -c
[ 'x("%%") \r\n' ]
x("%")
x("%"); |
Notice that printing the whole array looks correct, but retrieving the string and print that, |
I think the https://nodejs.org/api/console.html#console_console_log_data_args
|
We are both looking at the wrong side - it's $ node -v
v0.10.48
$ echo 'console.log("%%")' | node
%
$ node -v
v4.8.3
$ echo 'console.log("%%")' | node
%% |
@rvanvelzen yup, what you just said 👍 |
Making a PR to fix |
Yes, @rvanvelzen @alexlamsl - I recall that node bug now. They changed the way
In any case we'd have to avoid using such a call for binary (unicode) data. |
Shouldn't we avoid
|
I was about to copy from |
At least the
|
Regarding the newline at the end of the console output, I think this is slightly more efficient:
than:
but this is splitting hairs. |
(aside: |
Why not - better than losing hair... 😏 |
Partially reverts mishoo#2059 as this has better coverage and performance. fixes mishoo#2062
No description provided.