You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-10 11:43:01 +03:00
Optimize statements and speed up the common case
This commit is contained in:
@@ -11,7 +11,7 @@ function ReplyParser(return_buffers) {
|
||||
this.name = exports.name;
|
||||
this.return_buffers = return_buffers;
|
||||
|
||||
this._buffer = null;
|
||||
this._buffer = new Buffer(0);
|
||||
this._offset = 0;
|
||||
this._encoding = "utf-8";
|
||||
}
|
||||
@@ -171,18 +171,10 @@ ReplyParser.prototype.execute = function (buffer) {
|
||||
|
||||
ReplyParser.prototype.append = function (newBuffer) {
|
||||
|
||||
// first run
|
||||
if (this._buffer === null) {
|
||||
this._buffer = newBuffer;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// out of data
|
||||
if (this._offset >= this._buffer.length) {
|
||||
this._buffer = newBuffer;
|
||||
this._offset = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user