aboutsummaryrefslogtreecommitdiff
path: root/benchmark/buffers/buffer-read.js
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/buffers/buffer-read.js')
-rw-r--r--benchmark/buffers/buffer-read.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/benchmark/buffers/buffer-read.js b/benchmark/buffers/buffer-read.js
index 339da75bef..22f8dcbd3d 100644
--- a/benchmark/buffers/buffer-read.js
+++ b/benchmark/buffers/buffer-read.js
@@ -15,7 +15,9 @@ const types = [
'FloatLE',
'FloatBE',
'DoubleLE',
- 'DoubleBE'
+ 'DoubleBE',
+ 'IntLE',
+ 'IntBE',
];
const bench = common.createBenchmark(main, {
@@ -34,11 +36,19 @@ function main(conf) {
const fn = `read${type}`;
buff.writeDoubleLE(0, 0, noAssert);
- const testFunction = new Function('buff', `
- for (var i = 0; i !== ${len}; i++) {
- buff.${fn}(0, ${JSON.stringify(noAssert)});
- }
- `);
+
+ var call;
+ if (fn === 'readIntLE' || fn === 'readIntBE') {
+ call = `buff.${fn}(0, 1, ${JSON.stringify(noAssert)})`;
+ } else {
+ call = `buff.${fn}(0, ${JSON.stringify(noAssert)})`;
+ }
+
+ const testFunction = new Function(
+ 'buff',
+ `for (var i = 0; i !== ${len}; ++i) { ${call}; }`
+ );
+
bench.start();
testFunction(buff);
bench.end(len / 1e6);