1
0
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:
Ruben Bridgewater
2015-10-02 20:21:13 +02:00
parent 2ca42417bf
commit 2744fe8650
4 changed files with 21 additions and 15 deletions

View File

@@ -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;
}