buffer: use constexpr where possible
Self-explanatory cc @nodejs/buffer
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 90.18%. Comparing base (
723d7bb) to head (6577341). Report is 28 commits behind head on main.
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
| Files with missing lines | Coverage Ξ | |
|---|---|---|
| src/node_buffer.cc | 69.09% <ΓΈ> (ΓΈ) |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
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 π
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.
CI: https://ci.nodejs.org/job/node-test-pull-request/66570/
CI: https://ci.nodejs.org/job/node-test-pull-request/66573/
CI: https://ci.nodejs.org/job/node-test-pull-request/66596/
CI: https://ci.nodejs.org/job/node-test-pull-request/66627/
CI: https://ci.nodejs.org/job/node-test-pull-request/66633/
Landed in 2c36ffec46cb00a28df6509017c67b1eca994857