Buffer.byteLength
Performance Regression from v18.x to v22.x
#50620
Labels
buffer
Issues and PRs related to the buffer subsystem.
performance
Issues and PRs related to the performance of Node.js.
For
Buffer.byteLength(string[, encoding])
, when setencoding
isbuffer
:During my investigation, I found that the performance regression might be due to
ArrayBufferView.byteLength
.for the implementation of
Buffer.byteLength
inlib
:when
string.byteLength
is not called in either v18.x or v22.x(for example, change toreturn 0
), the regression nearly disappears:Based on the findings, it appears that the handling of
ArrayBufferView.byteLength
might be the cause of the performance regression observed.The text was updated successfully, but these errors were encountered: