Skip to content

Commit

Permalink
fixup: use primordials
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Aug 10, 2024
1 parent 27a11a3 commit ec3482d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions benchmark/buffers/buffer-write-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
encoding: [
'utf8',
'', 'utf8', 'ascii', 'hex', 'utf16le', 'latin1',
],
args: [ '' ],
len: [1,8,16,32, 64],
args: [ '', 'offset', 'offset+length' ],
len: [2048],
n: [1e6],
});

Expand Down
4 changes: 2 additions & 2 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1109,10 +1109,10 @@ Buffer.prototype.write = function write(string, offset, length, encoding) {
}

const len = string.length;
if (len <= 32 && len <= length) {
if (len <= 16 && len <= length) {
let n = 0;
while (true) {
const code = string.charCodeAt(n);
const code = StringPrototypeCharCodeAt(string, n);
if (code >= 128) {
break;
}
Expand Down

0 comments on commit ec3482d

Please sign in to comment.