8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dcfda10 commit ffdc046Copy full SHA for ffdc046
benchmark/buffers/buffer-compare-instance-method.js
@@ -0,0 +1,29 @@
1
+'use strict';
2
+const common = require('../common.js');
3
+const v8 = require('v8');
4
+
5
+const bench = common.createBenchmark(main, {
6
+ size: [16, 512, 1024, 4096, 16386],
7
+ millions: [1]
8
+});
9
10
+function main(conf) {
11
+ const iter = (conf.millions >>> 0) * 1e6;
12
+ const size = (conf.size >>> 0);
13
+ const b0 = new Buffer(size).fill('a');
14
+ const b1 = new Buffer(size).fill('a');
15
16
+ b1[size - 1] = 'b'.charCodeAt(0);
17
18
+ // Force optimization before starting the benchmark
19
+ b0.compare(b1);
20
+ v8.setFlagsFromString('--allow_natives_syntax');
21
+ eval('%OptimizeFunctionOnNextCall(b0.compare)');
22
23
24
+ bench.start();
25
+ for (var i = 0; i < iter; i++) {
26
27
+ }
28
+ bench.end(iter / 1e6);
29
+}