Skip to content

Commit

Permalink
benchmark: enable assert benchmark with short len
Browse files Browse the repository at this point in the history
`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: nodejs/node#15174
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and addaleax committed Sep 17, 2017
1 parent 53bf902 commit e2b00b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion benchmark/assert/deepequal-typedarrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function main(conf) {
const actual = new clazz(len);
const expected = new clazz(len);
const expectedWrong = Buffer.alloc(len);
expectedWrong[100] = 123;
const wrongIndex = Math.floor(len / 2);
expectedWrong[wrongIndex] = 123;
var i;

switch (conf.method) {
Expand Down

0 comments on commit e2b00b4

Please sign in to comment.