You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Improve performance further
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
|
||||
var util = require('util');
|
||||
|
||||
function ReplyParser(return_buffers) {
|
||||
function ReplyParser() {
|
||||
this.name = exports.name;
|
||||
this.return_buffers = return_buffers;
|
||||
|
||||
this._buffer = new Buffer(0);
|
||||
this._offset = 0;
|
||||
@@ -37,10 +36,8 @@ ReplyParser.prototype._parseResult = function (type) {
|
||||
|
||||
if (type === 45) {
|
||||
return new Error(this._buffer.toString(this._encoding, start, end));
|
||||
} else if (this.return_buffers) {
|
||||
return this._buffer.slice(start, end);
|
||||
}
|
||||
return this._buffer.toString(this._encoding, start, end);
|
||||
return this._buffer.slice(start, end);
|
||||
} else if (type === 58) { // :
|
||||
// up to the delimiter
|
||||
end = this._packetEndOffset() - 1;
|
||||
@@ -77,15 +74,12 @@ ReplyParser.prototype._parseResult = function (type) {
|
||||
// set the offset to after the delimiter
|
||||
this._offset = end + 2;
|
||||
|
||||
if (this.return_buffers) {
|
||||
return this._buffer.slice(start, end);
|
||||
}
|
||||
return this._buffer.toString(this._encoding, start, end);
|
||||
return this._buffer.slice(start, end);
|
||||
} else if (type === 42) { // *
|
||||
offset = this._offset;
|
||||
packetHeader = this.parseHeader();
|
||||
|
||||
if (packetHeader < 0) {
|
||||
if (packetHeader === -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user