From 63eb56b9f2651cfa2d0fadacbf46e49dd24db390 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 31 Dec 2013 17:11:56 -0800 Subject: [PATCH] perf: add new test --- perf/solo/readUInt32BE.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 perf/solo/readUInt32BE.js diff --git a/perf/solo/readUInt32BE.js b/perf/solo/readUInt32BE.js new file mode 100644 index 0000000..1e2675e --- /dev/null +++ b/perf/solo/readUInt32BE.js @@ -0,0 +1,26 @@ +var benchmark = require('benchmark') +var suite = new benchmark.Suite() + +global.NewBuffer = require('../../').Buffer // native-buffer-browserify + +var LENGTH = 20 + +var newTarget = NewBuffer(LENGTH * 4) + +for (var i = 0; i < LENGTH; i++) { + newTarget.writeUInt32LE(7000 + i, i * 4) +} + +suite.add('NewBuffer#readUInt32BE', function () { + for (var i = 0; i < LENGTH; i++) { + var x = newTarget.readUInt32BE(i * 4) + } +}) +.on('error', function (event) { + console.error(event.target.error.stack) +}) +.on('cycle', function (event) { + console.log(String(event.target)) +}) + +.run({ 'async': true }) -- 2.34.1