+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
-
-var LENGTH = 50
-
-var newTarget = NewBuffer(LENGTH)
-var oldTarget = OldBuffer(LENGTH)
-var nodeTarget = Buffer(LENGTH)
-
-suite.add('NewBuffer#bracket-notation', function () {
- for (var i = 0; i < LENGTH; i++) {
- newTarget[i] = i + 97
- }
-})
-.add('OldBuffer#bracket-notation', function () {
- for (var i = 0; i < LENGTH; i++) {
- oldTarget[i] = i + 97
- }
-})
-.add('Buffer#bracket-notation', function () {
- for (var i = 0; i < LENGTH; i++) {
- nodeTarget[i] = i + 97
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
var LENGTH = 50
+var browserBuffer = new BrowserBuffer(LENGTH)
+var typedarray = new Uint8Array(LENGTH)
+var nodeBuffer = new Buffer(LENGTH)
-var newTarget = NewBuffer(LENGTH)
-var oldTarget = OldBuffer(LENGTH)
-var nodeTarget = Buffer(LENGTH)
+suite
+ .add('BrowserBuffer#bracket-notation', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ browserBuffer[i] = i + 97
+ }
+ })
+ .add('Uint8Array#bracket-notation', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ typedarray[i] = i + 97
+ }
+ })
-suite.add('NewBuffer#bracket-notation', function () {
- for (var i = 0; i < LENGTH; i++) {
- newTarget[i] = i + 97
- }
-})
-.add('OldBuffer#bracket-notation', function () {
- for (var i = 0; i < LENGTH; i++) {
- oldTarget[i] = i + 97
- }
-})
-.add('Buffer#bracket-notation', function () {
- for (var i = 0; i < LENGTH; i++) {
- nodeTarget[i] = i + 97
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
+if (!process.browser) suite
+ .add('NodeBuffer#bracket-notation', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ nodeBuffer[i] = i + 97
+ }
+ })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 160
+var browserBuffer = new BrowserBuffer(LENGTH)
+var browserBuffer2 = new BrowserBuffer(LENGTH)
+var typedarray = new Uint8Array(LENGTH)
+var typedarray2 = new Uint8Array(LENGTH)
+var nodeBuffer = new Buffer(LENGTH)
+var nodeBuffer2 = new Buffer(LENGTH)
-var LENGTH = 16
-
-var newBuf = NewBuffer(LENGTH)
-var newBuf2 = NewBuffer(LENGTH)
-var oldBuf = OldBuffer(LENGTH)
-var oldBuf2 = OldBuffer(LENGTH)
-var nodeBuf = Buffer(LENGTH)
-var nodeBuf2 = Buffer(LENGTH)
-
-;[newBuf, newBuf2, oldBuf, oldBuf2, nodeBuf, nodeBuf2].forEach(function (buf) {
+;[browserBuffer, browserBuffer2, typedarray, typedarray2, nodeBuffer, nodeBuffer2].forEach(function (buf) {
for (var i = 0; i < LENGTH; i++) {
- buf[i] = 42
+ buf[i] = i + 97
}
})
-suite.add('NewBuffer#concat', function () {
- var x = Buffer.concat([newBuf, newBuf2])
-})
-.add('OldBuffer#concat', function () {
- var x = Buffer.concat([oldBuf, oldBuf2])
-})
-.add('Buffer#concat', function () {
- var x = Buffer.concat([nodeBuf, nodeBuf2])
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
\ No newline at end of file
+suite
+ .add('BrowserBuffer#concat', function () {
+ var x = BrowserBuffer.concat([browserBuffer, browserBuffer2], LENGTH * 2)
+ })
+ .add('Uint8Array#concat', function () {
+ var x = new Uint8Array(LENGTH * 2)
+ x.set(typedarray, 0)
+ x.set(typedarray2, typedarray.length)
+ })
+
+if (!process.browser) suite
+ .add('NodeBuffer#concat', function () {
+ var x = Buffer.concat([nodeBuffer, nodeBuffer2], LENGTH * 2)
+ })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 16000
-var LENGTH = 10000
+var browserSubject = new BrowserBuffer(LENGTH)
+var typedarraySubject = new Uint8Array(LENGTH)
+var nodeSubject = new Buffer(LENGTH)
-var newSubject = NewBuffer(LENGTH)
-var oldSubject = OldBuffer(LENGTH)
-var nodeSubject = Buffer(LENGTH)
+var browserTarget = new BrowserBuffer(LENGTH)
+var typedarrayTarget = new Uint8Array(LENGTH)
+var nodeTarget = new Buffer(LENGTH)
-var newTarget = NewBuffer(LENGTH)
-var oldTarget = OldBuffer(LENGTH)
-var nodeTarget = Buffer(LENGTH)
+suite
+ .add('BrowserBuffer#copy (' + LENGTH + ')', function () {
+ browserSubject.copy(browserTarget)
+ })
+ .add('Uint8Array#copy (' + LENGTH + ')', function () {
+ typedarrayTarget.set(typedarraySubject, 0)
+ })
-suite.add('NewBuffer#copy', function () {
- newSubject.copy(newTarget)
-})
-.add('OldBuffer#copy', function () {
- oldSubject.copy(oldTarget)
-})
-.add('Buffer#copy', function () {
- nodeSubject.copy(nodeTarget)
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
\ No newline at end of file
+if (!process.browser) suite
+ .add('NodeBuffer#copy (' + LENGTH + ')', function () {
+ nodeSubject.copy(nodeTarget)
+ })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 16
-var LENGTH = 10
+var browserSubject = new BrowserBuffer(LENGTH)
+var typedarraySubject = new Uint8Array(LENGTH)
+var nodeSubject = new Buffer(LENGTH)
-var newSubject = NewBuffer(LENGTH)
-var oldSubject = OldBuffer(LENGTH)
-var nodeSubject = Buffer(LENGTH)
+var browserTarget = new BrowserBuffer(LENGTH)
+var typedarrayTarget = new Uint8Array(LENGTH)
+var nodeTarget = new Buffer(LENGTH)
-var newTarget = NewBuffer(LENGTH)
-var oldTarget = OldBuffer(LENGTH)
-var nodeTarget = Buffer(LENGTH)
+suite
+ .add('BrowserBuffer#copy (' + LENGTH + ')', function () {
+ browserSubject.copy(browserTarget)
+ })
+ .add('Uint8Array#copy (' + LENGTH + ')', function () {
+ typedarrayTarget.set(typedarraySubject, 0)
+ })
-suite.add('NewBuffer#copy', function () {
- newSubject.copy(newTarget)
-})
-.add('OldBuffer#copy', function () {
- oldSubject.copy(oldTarget)
-})
-.add('Buffer#copy', function () {
- nodeSubject.copy(nodeTarget)
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
\ No newline at end of file
+if (!process.browser) suite
+ .add('NodeBuffer#copy (' + LENGTH + ')', function () {
+ nodeSubject.copy(nodeTarget)
+ })
+++ /dev/null
-<script src='bundle.js'></script>
\ No newline at end of file
--- /dev/null
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
+
+var LENGTH = 16000
+
+suite
+ .add('BrowserBuffer#new (' + LENGTH + ')', function () {
+ var buf = new BrowserBuffer(LENGTH)
+ })
+ .add('Uint8Array#new (' + LENGTH + ')', function () {
+ var buf = new Uint8Array(LENGTH)
+ })
+
+if (!process.browser) suite
+ .add('NodeBuffer#new (' + LENGTH + ')', function () {
+ var buf = new Buffer(LENGTH)
+ })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 16
-var LENGTH = 10
-
-suite.add('NewBuffer#new', function () {
- var buf = NewBuffer(LENGTH)
-})
-.add('Uint8Array#new', function () {
- var buf = new Uint8Array(LENGTH)
-})
-.add('OldBuffer#new', function () {
- var buf = OldBuffer(LENGTH)
-})
-.add('Buffer#new', function () {
- var buf = Buffer(LENGTH)
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
\ No newline at end of file
+suite
+ .add('BrowserBuffer#new (' + LENGTH + ')', function () {
+ var buf = new BrowserBuffer(LENGTH)
+ })
+ .add('Uint8Array#new (' + LENGTH + ')', function () {
+ var buf = new Uint8Array(LENGTH)
+ })
+ .add('NodeBuffer#new (' + LENGTH + ')', function () {
+ var buf = new Buffer(LENGTH)
+ })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 160
-var LENGTH = 10
+var browserBuffer = new BrowserBuffer(LENGTH * 8)
+var typedarray = new Uint8Array(LENGTH * 8)
+var dataview = new DataView(typedarray.buffer)
+var nodeBuffer = new Buffer(LENGTH * 8)
-var newTarget = NewBuffer(LENGTH * 8)
-var oldTarget = OldBuffer(LENGTH * 8)
-var nodeTarget = Buffer(LENGTH * 8)
-
-;[newTarget, oldTarget, nodeTarget].forEach(function (buf) {
+;[browserBuffer, nodeBuffer].forEach(function (buf) {
for (var i = 0; i < LENGTH; i++) {
buf.writeDoubleBE(97.1919 + i, i * 8)
}
})
-suite.add('NewBuffer#readDoubleBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = newTarget.readDoubleBE(i * 8)
- }
-})
-.add('OldBuffer#readDoubleBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = oldTarget.readDoubleBE(i * 8)
- }
-})
-.add('Buffer#readDoubleBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = nodeTarget.readDoubleBE(i * 8)
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
+for (var i = 0; i < LENGTH; i++) {
+ dataview.setFloat64(i * 8, 97.1919 + i)
+}
+
+suite
+ .add('BrowserBuffer#readDoubleBE', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = browserBuffer.readDoubleBE(i * 8)
+ }
+ })
+ .add('DataView#getFloat64', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = dataview.getFloat64(i * 8)
+ }
+ })
+
+if (!process.browser) suite
+ .add('NodeBuffer#readDoubleBE', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = nodeBuffer.readDoubleBE(i * 8)
+ }
+ })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 160
-var LENGTH = 10
+var browserBuffer = new BrowserBuffer(LENGTH * 4)
+var typedarray = new Uint8Array(LENGTH * 4)
+var dataview = new DataView(typedarray.buffer)
+var nodeBuffer = new Buffer(LENGTH * 4)
-var newTarget = NewBuffer(LENGTH * 4)
-var oldTarget = OldBuffer(LENGTH * 4)
-var nodeTarget = Buffer(LENGTH * 4)
-
-;[newTarget, oldTarget, nodeTarget].forEach(function (buf) {
+;[browserBuffer, nodeBuffer].forEach(function (buf) {
for (var i = 0; i < LENGTH; i++) {
buf.writeFloatBE(97.1919 + i, i * 4)
}
})
-suite.add('NewBuffer#readFloatBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = newTarget.readFloatBE(i * 4)
- }
-})
-.add('OldBuffer#readFloatBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = oldTarget.readFloatBE(i * 4)
- }
-})
-.add('Buffer#readFloatBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = nodeTarget.readFloatBE(i * 4)
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
+for (var i = 0; i < LENGTH; i++) {
+ dataview.setFloat32(i * 4, 97.1919 + i)
+}
+
+suite
+ .add('BrowserBuffer#readFloatBE', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = browserBuffer.readFloatBE(i * 4)
+ }
+ })
+ .add('DataView#getFloat32', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = dataview.getFloat32(i * 4)
+ }
+ })
+
+if (!process.browser) suite
+ .add('NodeBuffer#readFloatBE', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = nodeBuffer.readFloatBE(i * 4)
+ }
+ })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 160
-var LENGTH = 20
+var browserBuffer = new BrowserBuffer(LENGTH * 4)
+var typedarray = new Uint8Array(LENGTH * 4)
+var dataview = new DataView(typedarray.buffer)
+var nodeBuffer = new Buffer(LENGTH * 4)
-var newTarget = NewBuffer(LENGTH * 4)
-var oldTarget = OldBuffer(LENGTH * 4)
-var nodeTarget = Buffer(LENGTH * 4)
-
-;[newTarget, oldTarget, nodeTarget].forEach(function (buf) {
+;[browserBuffer, nodeBuffer].forEach(function (buf) {
for (var i = 0; i < LENGTH; i++) {
buf.writeUInt32LE(7000 + i, i * 4)
}
})
-suite.add('NewBuffer#readUInt32LE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = newTarget.readUInt32LE(i * 4)
- }
-})
-.add('OldBuffer#readUInt32LE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = oldTarget.readUInt32LE(i * 4)
- }
-})
-.add('Buffer#readUInt32LE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = nodeTarget.readUInt32LE(i * 4)
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
+for (var i = 0; i < LENGTH; i++) {
+ dataview.setUint32(i * 4, 7000 + i)
+}
+
+suite
+ .add('BrowserBuffer#readUInt32LE', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = browserBuffer.readUInt32LE(i * 4)
+ }
+ })
+ .add('DataView#getUint32', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = dataview.getUint32(i * 4, true)
+ }
+ })
+
+if (!process.browser) suite
+ .add('NodeBuffer#readUInt32LE', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ var x = nodeBuffer.readUInt32LE(i * 4)
+ }
+ })
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 160
-var LENGTH = 16
+var browserBuffer = new BrowserBuffer(LENGTH)
+var typedarray = new Uint8Array(LENGTH)
+var nodeBuffer = new Buffer(LENGTH)
-var newBuf = NewBuffer(LENGTH)
-var oldBuf = OldBuffer(LENGTH)
-var nodeBuf = Buffer(LENGTH)
+suite
+ .add('BrowserBuffer#slice', function () {
+ var x = browserBuffer.slice(4)
+ })
+ .add('Uint8Array#subarray', function () {
+ var x = typedarray.subarray(4)
+ })
-suite.add('NewBuffer#slice', function () {
- var x = newBuf.slice(4)
-})
-.add('OldBuffer#slice', function () {
- var x = oldBuf.slice(4)
-})
-.add('Buffer#slice', function () {
- var x = nodeBuf.slice(4)
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
\ No newline at end of file
+if (!process.browser) suite
+ .add('NodeBuffer#slice', function () {
+ var x = nodeBuffer.slice(4)
+ })
--- /dev/null
+var benchmark = require('benchmark')
+
+exports.suite = function () {
+ var suite = new benchmark.Suite()
+ process.nextTick(function () {
+ suite
+ .on('error', function (event) {
+ console.error(event.target.error.stack)
+ })
+ .on('cycle', function (event) {
+ console.log(String(event.target))
+ })
+ .on('complete', function () {
+ console.log('Fastest is ' + this.filter('fastest').pluck('name'))
+ })
+ .run({ async: true })
+ })
+ return suite
+}
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
+var BrowserBuffer = require('../../').Buffer // (this module)
+var util = require('./util')
+var suite = util.suite()
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-global.OldBuffer = require('buffer-browserify').Buffer // buffer-browserify
+var LENGTH = 160
-var LENGTH = 10
+var browserBuffer = new BrowserBuffer(LENGTH * 4)
+var typedarray = new Uint8Array(LENGTH * 4)
+var dataview = new DataView(typedarray.buffer)
+var nodeBuffer = new Buffer(LENGTH * 4)
-var newTarget = NewBuffer(LENGTH * 4)
-var oldTarget = OldBuffer(LENGTH * 4)
-var nodeTarget = Buffer(LENGTH * 4)
+suite
+ .add('BrowserBuffer#writeFloatBE', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ browserBuffer.writeFloatBE(97.1919 + i, i * 4)
+ }
+ })
+ .add('DataView#setFloat32', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ dataview.setFloat32(i * 4, 97.1919 + i)
+ }
+ })
-suite.add('NewBuffer#writeFloatBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- newTarget.writeFloatBE(97.1919 + i, i * 4)
- }
-})
-.add('OldBuffer#writeFloatBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- oldTarget.writeFloatBE(97.1919 + i, i * 4)
- }
-})
-.add('Buffer#writeFloatBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- nodeTarget.writeFloatBE(97.1919 + i, i * 4)
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-.on('complete', function () {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'))
-})
-.run({ 'async': true })
+if (!process.browser) suite
+ .add('NodeBuffer#writeFloatBE', function () {
+ for (var i = 0; i < LENGTH; i++) {
+ nodeBuffer.writeFloatBE(97.1919 + i, i * 4)
+ }
+ })
+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-
-var LENGTH = 50
-
-var newTarget = NewBuffer(LENGTH)
-
-suite.add('NewBuffer#bracket-notation', function () {
- for (var i = 0; i < LENGTH; i++) {
- newTarget[i] = i + 97
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })
+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-
-var LENGTH = 16
-
-var newBuf = NewBuffer(LENGTH)
-var newBuf2 = NewBuffer(LENGTH)
-
-;[newBuf, newBuf2].forEach(function (buf) {
- for (var i = 0; i < LENGTH; i++) {
- buf[i] = 42
- }
-})
-
-suite.add('NewBuffer#concat', function () {
- var x = Buffer.concat([newBuf, newBuf2])
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })
\ No newline at end of file
+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-
-var LENGTH = 10
-
-var newSubject = NewBuffer(LENGTH)
-var newTarget = NewBuffer(LENGTH)
-
-suite.add('NewBuffer#copy', function () {
- newSubject.copy(newTarget)
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })
\ No newline at end of file
+++ /dev/null
-<script src='bundle.js'></script>
\ No newline at end of file
+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-
-var LENGTH = 10
-
-suite.add('NewBuffer#new', function () {
- var buf = NewBuffer(LENGTH)
-})
-.add('Uint8Array#new', function () {
- var buf = new Uint8Array(LENGTH)
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })
\ No newline at end of file
+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-
-var LENGTH = 10
-
-var newTarget = NewBuffer(LENGTH * 8)
-
-for (var i = 0; i < LENGTH; i++) {
- newTarget.writeDoubleBE(97.1919 + i, i * 8)
-}
-
-suite.add('NewBuffer#readDoubleBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = newTarget.readDoubleBE(i * 8)
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })
+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-
-var LENGTH = 10
-
-var newTarget = NewBuffer(LENGTH * 4)
-
-for (var i = 0; i < LENGTH; i++) {
- newTarget.writeFloatBE(97.1919 + i, i * 4)
-}
-
-suite.add('NewBuffer#readFloatBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = newTarget.readFloatBE(i * 4)
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })
+++ /dev/null
-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 })
+++ /dev/null
-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#readUInt32LE', function () {
- for (var i = 0; i < LENGTH; i++) {
- var x = newTarget.readUInt32LE(i * 4)
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })
+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-
-var LENGTH = 16
-
-var newBuf = NewBuffer(LENGTH)
-
-suite.add('NewBuffer#slice', function () {
- var x = newBuf.slice(4)
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })
\ No newline at end of file
+++ /dev/null
-var benchmark = require('benchmark')
-var suite = new benchmark.Suite()
-
-global.NewBuffer = require('../../').Buffer // native-buffer-browserify
-
-var LENGTH = 10
-
-var newTarget = NewBuffer(LENGTH * 4)
-
-suite.add('NewBuffer#writeFloatBE', function () {
- for (var i = 0; i < LENGTH; i++) {
- newTarget.writeFloatBE(97.1919 + i, i * 4)
- }
-})
-.on('error', function (event) {
- console.error(event.target.error.stack)
-})
-.on('cycle', function (event) {
- console.log(String(event.target))
-})
-
-.run({ 'async': true })