-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Description
Version
Output of node -v: (e.g. v20.10.0)
Platform
Output of uname -a (for UNIX) or Windows version string (for Windows).
Subsystem
buffers (benchmark/buffers/buffer-bytelength-string.js)
What steps will reproduce the bug?
Run the buffer byteLength benchmark for base64 encoding.
Expected: getInput should return a base64-encoded string when encoding is 'base64'.
Actual: getInput returns the original string, not the base64-encoded string.
How often does it reproduce? Is there a required condition?
Run the buffer byteLength benchmark for base64 encoding.
Expected: getInput should return a base64-encoded string when encoding is 'base64'.
Actual: getInput returns the original string, not the base64-encoded string.
What is the expected behavior? Why is that the expected behavior?
getInput should return the base64-encoded string so the benchmark accurately tests Buffer.byteLength for base64 input.
What do you see instead?
The benchmark tests the original string, not the base64-encoded string.
Additional information
Suggested fix:
In benchmark/buffers/buffer-bytelength-string.js, update getInput to return Buffer.from(original, 'utf8').toString('base64') when encoding is 'base64'.
This will ensure the benchmark is correct.