Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/buffers/buffer-tojson.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/benchmark/buffers/buffer-tojson.js b/benchmark/buffers/buffer-tojson.js
new file mode 100644
index 00000000000..1be59952c3f
--- /dev/null
+++ b/benchmark/buffers/buffer-tojson.js
@@ -0,0 +1,18 @@
+'use strict';
+
+const common = require('../common.js');
+
+const bench = common.createBenchmark(main, {
+ n: [1e4],
+ len: [0, 10, 256, 4 * 1024]
+});
+
+function main(conf) {
+ var n = +conf.n;
+ var buf = Buffer.allocUnsafe(+conf.len);
+
+ bench.start();
+ for (var i = 0; i < n; ++i)
+ buf.toJSON();
+ bench.end(n);
+}