redis-parser
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -0,1 +1,7 @@ | ||
## v.2.6.0 - 03 Apr, 2017 | ||
Internals | ||
- Use Buffer.allocUnsafe instead of new Buffer() with modern Node.js versions | ||
## v.2.5.0 - 11 Mar, 2017 | ||
@@ -16,3 +22,3 @@ | ||
- Fixed minimal memory consumtion overhead for chunked buffers | ||
- Fixed minimal memory consumption overhead for chunked buffers | ||
@@ -98,3 +104,3 @@ ## v.2.4.0 - 25 Jan, 2017 | ||
The javascript parser got completly rewritten by [Michael Diarmid](https://github.com/Salakar) and [Ruben Bridgewater](https://github.com/BridgeAR) and is now a lot faster than the hiredis parser. | ||
The javascript parser got completely rewritten by [Michael Diarmid](https://github.com/Salakar) and [Ruben Bridgewater](https://github.com/BridgeAR) and is now a lot faster than the hiredis parser. | ||
Therefore the hiredis parser was deprecated and should only be used for testing purposes and benchmarking comparison. | ||
@@ -101,0 +107,0 @@ |
@@ -7,3 +7,3 @@ 'use strict' | ||
var ParserError = require('./parserError') | ||
var bufferPool = new Buffer(32 * 1024) | ||
var bufferPool = bufferAlloc(32 * 1024) | ||
var bufferOffset = 0 | ||
@@ -13,4 +13,15 @@ var interval = null | ||
var notDecreased = 0 | ||
var isModern = typeof Buffer.allocUnsafe === 'function' | ||
/** | ||
* For backwards compatibility | ||
* @param len | ||
* @returns {Buffer} | ||
*/ | ||
function bufferAlloc (len) { | ||
return isModern ? Buffer.allocUnsafe(len) : new Buffer(len) | ||
} | ||
/** | ||
* Used for lengths and numbers only, faster perf on arrays / bulks | ||
@@ -327,4 +338,5 @@ * @param parser | ||
for (var key in options) { | ||
// eslint-disable-next-line valid-typeof | ||
if (optionTypes.hasOwnProperty(key) && typeof options[key] !== optionTypes[key]) { | ||
throw new TypeError('The options argument contains the property "' + key + '" that is either unkown or of a wrong type') | ||
throw new TypeError('The options argument contains the property "' + key + '" that is either unknown or of a wrong type') | ||
} | ||
@@ -434,3 +446,3 @@ } | ||
} | ||
bufferPool = new Buffer(length * multiplier + bufferOffset) | ||
bufferPool = bufferAlloc(length * multiplier + bufferOffset) | ||
bufferOffset = 0 | ||
@@ -520,3 +532,3 @@ counter++ | ||
var remainingLength = oldLength - this.offset | ||
var newBuffer = new Buffer(remainingLength + buffer.length) | ||
var newBuffer = bufferAlloc(remainingLength + buffer.length) | ||
this.buffer.copy(newBuffer, 0, this.offset, oldLength) | ||
@@ -523,0 +535,0 @@ buffer.copy(newBuffer, remainingLength, 0, buffer.length) |
{ | ||
"name": "redis-parser", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Javascript Redis protocol (RESP) parser", | ||
@@ -37,3 +37,3 @@ "main": "index.js", | ||
"istanbul": "^0.4.0", | ||
"standard": "^8.5.0", | ||
"standard": "^9.0.0", | ||
"mocha": "^3.1.2", | ||
@@ -40,0 +40,0 @@ "hiredis": "^0.5.0" |
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
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
31202
659