atomicbuffers
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "atomicbuffers", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Atomic `readInt32()`, `writeInt32()`, `readUInt32()` and `writeUInt32()` for node.js buffers.", | ||
@@ -23,2 +23,3 @@ "main": "lib/atomicbuffers.js", | ||
"devDependencies": { | ||
"mmap.js": "^1.0.1", | ||
"mocha": "^1.21.5" | ||
@@ -25,0 +26,0 @@ }, |
@@ -35,2 +35,7 @@ "use strict"; | ||
}); | ||
it('should throw on oob', function() { | ||
assert.throws(function() { | ||
atomic.writeInt32(buf, 0, buf.length); | ||
}); | ||
}); | ||
}); | ||
@@ -60,2 +65,7 @@ | ||
}); | ||
it('should throw on oob', function() { | ||
assert.throws(function() { | ||
atomic.writeUInt32(buf, 0, buf.length); | ||
}); | ||
}); | ||
}); | ||
@@ -85,2 +95,8 @@ | ||
}); | ||
it('should throw on oob', function() { | ||
assert.throws(function() { | ||
atomic.readInt32(buf, buf.length); | ||
}); | ||
}); | ||
}); | ||
@@ -122,6 +138,12 @@ | ||
}); | ||
it('should throw on oob', function() { | ||
assert.throws(function() { | ||
atomic.readUInt32(buf, buf.length); | ||
}); | ||
}); | ||
}); | ||
describe('Benchmarks', function () { | ||
let buf = new Buffer(16).fill(0); | ||
var buf = new Buffer(16).fill(0); | ||
buf.writeInt32LE(123, 0); | ||
@@ -131,6 +153,6 @@ buf.writeUInt32LE(456, 4); | ||
benchmark("readInt32", 1000000, { | ||
Native () { | ||
Native: function () { | ||
return atomic.readInt32(buf, 0); | ||
}, | ||
Node () { | ||
Node: function () { | ||
return buf.readInt32LE(0); | ||
@@ -141,6 +163,6 @@ } | ||
benchmark("readUInt32", 1000000, { | ||
Native () { | ||
Native: function () { | ||
return atomic.readUInt32(buf, 4); | ||
}, | ||
Node () { | ||
Node: function () { | ||
return buf.readUInt32LE(4); | ||
@@ -151,6 +173,6 @@ } | ||
benchmark("writeInt32", 1000000, { | ||
Native () { | ||
Native: function () { | ||
return atomic.writeInt32(buf, 4096, 0); | ||
}, | ||
Node () { | ||
Node: function () { | ||
return buf.writeInt32LE(4096, 0); | ||
@@ -161,6 +183,6 @@ } | ||
benchmark("writeUInt32", 1000000, { | ||
Native () { | ||
Native: function () { | ||
return atomic.writeUInt32(buf, 4096, 0); | ||
}, | ||
Node () { | ||
Node: function () { | ||
return buf.writeUInt32LE(4096, 0); | ||
@@ -167,0 +189,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35950
18
313
2
2