util(styleText): optimise + benchmark#58063
util(styleText): optimise + benchmark#58063AugustinMauroy wants to merge 3 commits intonodejs:mainfrom
Conversation
|
Review requested:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #58063 +/- ##
=======================================
Coverage 90.21% 90.21%
=======================================
Files 630 630
Lines 186391 186448 +57
Branches 36610 36620 +10
=======================================
+ Hits 168146 168209 +63
+ Misses 11066 11038 -28
- Partials 7179 7201 +22
🚀 New features to boost your workflow:
|
Please don't do that, we discussed it a lot. Those refactors are not useful. |
oh okay, surprising because the use cases with the |
7e02fbd to
369b13f
Compare
cf38ccd to
ae69a04
Compare
lib/util.js
Outdated
|
|
||
| // If the stream is falsy or should not be colorized, set skipColorize to true | ||
| skipColorize = !lazyUtilColors().shouldColorize(stream); | ||
| if (!lazyUtilColors().shouldColorize(stream)) { |
There was a problem hiding this comment.
early return will skip validation so its a necessary overhead
#56722 (comment)
RafaelGSS
left a comment
There was a problem hiding this comment.
As Marco mentioned, the "overhead" is necessary.
|
Can I just keep benchmark change ? |
Yes, but I'd do it as a separate benchmark, so we don't need to have benchmarks for: noColors: true, format: 'italic', As they will all be the same. So, adding it as a separate benchmark makes more sense. |
Co-Authored-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
029701a to
ef34ff0
Compare
| validateStream: [1, 0], | ||
| n: [1e3], | ||
| }); | ||
| withColor: { |
There was a problem hiding this comment.
Please, create a different file instead. style-text-nocolor.js
I had modify logic behind. using a reducer, it's should be quicker. And I had updated benchmark
Plus I had updated test to usenode:testin goal of having better DX when something fails.