-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
console: optimize single-string logging #60422
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
base: main
Are you sure you want to change the base?
Conversation
|
Review requested:
|
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.
It would also be possible to speed up other arguments by calling inspect directly for these. I guess that would also improve their performance a bit.
About the map vs symbol property: I doubt that it changes the performance, while it does make the property visible.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60422 +/- ##
==========================================
- Coverage 88.57% 88.56% -0.02%
==========================================
Files 704 704
Lines 207778 207798 +20
Branches 40030 40027 -3
==========================================
- Hits 184049 184040 -9
- Misses 15768 15799 +31
+ Partials 7961 7959 -2
🚀 New features to boost your workflow:
|
|
@BridgeAR I'm getting a measurable, consistent difference: With the WeakMap change: console/log.js
console/log.js variant="plain" n=2000000: 10,883,048.308746813
console/log.js variant="format" n=2000000: 3,149,799.334788839
console/log.js variant="object" n=2000000: 1,264,378.6850980576
console/log.js variant="group" n=2000000: 5,179,205.360995469
console/log.js variant="info" n=2000000: 10,917,626.507997163
console/log.js variant="warn" n=2000000: 10,770,223.543582655
console/log.js variant="error" n=2000000: 10,905,653.149791192Without it: console/log.js
console/log.js variant="plain" n=2000000: 10,081,197.747104334
console/log.js variant="format" n=2000000: 3,018,537.215869073
console/log.js variant="object" n=2000000: 1,261,919.5199784338
console/log.js variant="group" n=2000000: 4,423,174.704583957
console/log.js variant="info" n=2000000: 10,469,331.438858952
console/log.js variant="warn" n=2000000: 10,366,440.721452443
console/log.js variant="error" n=2000000: 10,422,488.603660118I'll let you decide, but it seems to be there |
|
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1749/ |
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
After:
Before:
This peaked my interest in the flame graph:
console.log.||on every invocation.P.S. Couldn't find any benchmarks for
console.log. And inspect benchmarks won't pick this up...