-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
buffer: use constexpr where possible #58141
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #58141 +/- ##
=======================================
Coverage 90.17% 90.18%
=======================================
Files 630 630
Lines 186473 186473
Branches 36613 36615 +2
=======================================
+ Hits 168160 168166 +6
+ Misses 11128 11119 -9
- Partials 7185 7188 +3
🚀 New features to boost your workflow:
|
Just for my education, does it really change the assembly emitted by compilers. This seems trivial to optimize but I don't know much about it 🙈 |
Yes. The if statement that checks for these conditions will not be evaluated on runtime, but rather on compile time. Since this parameter is a template argument, we can make it a constexpr. |
This comment was marked as outdated.
This comment was marked as outdated.
Landed in 2c36ffe |
PR-URL: #58141 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
PR-URL: #58141 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Robert Nagy <[email protected]>
Self-explanatory cc @nodejs/buffer