Browse Source

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: https://github.com/nodejs/node/pull/15174
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
canary-base
Rich Trott 8 years ago
committed by James M Snell
parent
commit
11f46a2586
  1. 3
      benchmark/assert/deepequal-typedarrays.js

3
benchmark/assert/deepequal-typedarrays.js

@ -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) {

Loading…
Cancel
Save