mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
411 B
20 lines
411 B
12 years ago
|
SlowBuffer = require('buffer').SlowBuffer;
|
||
|
|
||
|
var common = require('../common.js');
|
||
|
var bench = common.createBenchmark(main, {
|
||
12 years ago
|
type: ['fast', 'slow'],
|
||
12 years ago
|
len: [10, 1024],
|
||
|
n: [1024]
|
||
|
});
|
||
|
|
||
|
function main(conf) {
|
||
|
var len = +conf.len;
|
||
|
var n = +conf.n;
|
||
12 years ago
|
var clazz = conf.type === 'fast' ? Buffer : SlowBuffer;
|
||
12 years ago
|
bench.start();
|
||
|
for (var i = 0; i < n * 1024; i++) {
|
||
12 years ago
|
b = new clazz(len);
|
||
12 years ago
|
}
|
||
|
bench.end(n);
|
||
|
}
|