Skip to content

Commit ec3482d

Browse files
committed
fixup: use primordials
1 parent 27a11a3 commit ec3482d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

benchmark/buffers/buffer-write-string.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
const common = require('../common.js');
44
const bench = common.createBenchmark(main, {
55
encoding: [
6-
'utf8',
6+
'', 'utf8', 'ascii', 'hex', 'utf16le', 'latin1',
77
],
8-
args: [ '' ],
9-
len: [1,8,16,32, 64],
8+
args: [ '', 'offset', 'offset+length' ],
9+
len: [2048],
1010
n: [1e6],
1111
});
1212

lib/buffer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1109,10 +1109,10 @@ Buffer.prototype.write = function write(string, offset, length, encoding) {
11091109
}
11101110

11111111
const len = string.length;
1112-
if (len <= 32 && len <= length) {
1112+
if (len <= 16 && len <= length) {
11131113
let n = 0;
11141114
while (true) {
1115-
const code = string.charCodeAt(n);
1115+
const code = StringPrototypeCharCodeAt(string, n);
11161116
if (code >= 128) {
11171117
break;
11181118
}

0 commit comments

Comments
 (0)