-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Benchmark: add destructuring object #8680
Conversation
var x = o.x; | ||
var y = o.y; | ||
var r = o.r || 2; | ||
assert.strictEqual(x, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These assert
calls are unnecessary and will just slow down the benchmark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just follow other benchmark cases. Need to delete them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all assert
and results: ~38% improvement higher is better
λ ~/D/o/node git:(master) 1≡ 1M > ./node benchmark/es/destructuring-object-bench.js
es/destructuring-object-bench.js millions=100 method="normal": 903.2505158892741
es/destructuring-object-bench.js millions=100 method="destructureObject": 564.4660663547472
λ ~/D/o/node git:(master) 1≡ 1M > ./node benchmark/es/destructuring-object-bench.js
es/destructuring-object-bench.js millions=100 method="normal": 890.7910802024818
es/destructuring-object-bench.js millions=100 method="destructureObject": 547.1594066200685
λ ~/D/o/node git:(master) 1≡ 1M > ./node benchmark/es/destructuring-object-bench.js
es/destructuring-object-bench.js millions=100 method="normal": 900.7505972742099
es/destructuring-object-bench.js millions=100 method="destructureObject": 523.6524462787967
The benchmark results you've posted show that non-destructuring is faster (higher number, since results are ops/sec.). Even so, having this benchmark might be nice to have anyway. |
😂 I think it's excuted times. Sorry |
If you remove the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@fundon Before we can land this, could you please address following linter errors:
|
I think we can add code comments to ignore those particular linter errors? |
I agree. @fundon You can enclose lines 15-17 and line 27 with: /* eslint-disable no-unused-vars */
...
/* eslint-enable no-unused-vars */ |
Ok, I update it. |
Some tests failed. What should i do? |
@fundon CI failures are unrelated. They all seem to be known issues. I'll start prepping this PR for landing in few hours 👍 |
Landing:
|
PR-URL: nodejs#8680 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ilkka Myller <[email protected]>
PR-URL: #8680 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ilkka Myller <[email protected]>
PR-URL: nodejs#8680 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ilkka Myller <[email protected]>
PR-URL: #8680 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ilkka Myller <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
Description of change
Maybe throse codes should be changed:FROM
https://github.com/nodejs/node/blob/master/lib/fs.js#L1-L40
TO
Benchmark Results: ~~~23% improvement~~ higher is better