summaryrefslogtreecommitdiff
path: root/benchmark/assert
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-09-03 13:54:29 -0700
committerJames M Snell <jasnell@gmail.com>2017-09-15 15:34:32 -0700
commit11f46a2586544e71c13e2de9c992ba3e48354a09 (patch)
tree109af776b8b724b06041a98a500c5096b02e4a0f /benchmark/assert
parent0fc402b99213a47f973a0a22d1ee01662fc3d7d9 (diff)
downloadandroid-node-v8-11f46a2586544e71c13e2de9c992ba3e48354a09.tar.gz
android-node-v8-11f46a2586544e71c13e2de9c992ba3e48354a09.tar.bz2
android-node-v8-11f46a2586544e71c13e2de9c992ba3e48354a09.zip
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/assert')
-rw-r--r--benchmark/assert/deepequal-typedarrays.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/benchmark/assert/deepequal-typedarrays.js b/benchmark/assert/deepequal-typedarrays.js
index 5d51d53d13..6794ced081 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) {