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: #15174
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and jasnell committed Sep 20, 2017
1 parent d30a583 commit 3bf718c
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 3bf718c

Please sign in to comment.