Skip to content

Commit 3bf718c

Browse files
Trottjasnell
authored andcommitted
benchmark: enable assert benchmark with short len
`deepequal-typedarrays.js` throws if `len` is set to 100 or less due to a hardcoded index. Calculate the index based on `len` so benchmark can be run with small `len` values if desired. PR-URL: #15174 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent d30a583 commit 3bf718c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

benchmark/assert/deepequal-typedarrays.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ function main(conf) {
3333
const actual = new clazz(len);
3434
const expected = new clazz(len);
3535
const expectedWrong = Buffer.alloc(len);
36-
expectedWrong[100] = 123;
36+
const wrongIndex = Math.floor(len / 2);
37+
expectedWrong[wrongIndex] = 123;
3738
var i;
3839

3940
switch (conf.method) {

0 commit comments

Comments
 (0)