diff options
author | Rich Trott <rtrott@gmail.com> | 2017-09-03 23:54:29 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-09-20 19:22:59 +0300 |
commit | 3bf718c3fe24588813b62c01dc4cbeb3ec8aad9c (patch) | |
tree | 1402bfa4b1273d73bdd39a54e5c93c46148a0aef /benchmark | |
parent | d30a5836b6af2845e86d1bffd6183b920a45910f (diff) |
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>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/assert/deepequal-typedarrays.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/benchmark/assert/deepequal-typedarrays.js b/benchmark/assert/deepequal-typedarrays.js index f748a6042fd..8e8cc4b083a 100644 --- a/benchmark/assert/deepequal-typedarrays.js +++ b/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) { |