node icon indicating copy to clipboard operation
node copied to clipboard

buffer: use constexpr where possible

Open anonrig opened this issue 7 months ago β€’ 6 comments

Self-explanatory cc @nodejs/buffer

anonrig avatar May 03 '25 16:05 anonrig

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% <ΓΈ> (ΓΈ)

... and 31 files with indirect coverage changes

: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.

codecov[bot] avatar May 03 '25 17:05 codecov[bot]

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 πŸ™ˆ

targos avatar May 03 '25 18:05 targos

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.

anonrig avatar May 03 '25 18:05 anonrig

CI: https://ci.nodejs.org/job/node-test-pull-request/66570/

nodejs-github-bot avatar May 03 '25 18:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66573/

nodejs-github-bot avatar May 03 '25 22:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66596/

nodejs-github-bot avatar May 04 '25 19:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66627/

nodejs-github-bot avatar May 05 '25 21:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66633/

nodejs-github-bot avatar May 06 '25 02:05 nodejs-github-bot

Landed in 2c36ffec46cb00a28df6509017c67b1eca994857

nodejs-github-bot avatar May 06 '25 16:05 nodejs-github-bot