Skip to content

Commit c03c8db

Browse files
authored
Merge pull request #26 from NodeRedis/improve-array-parsing
Improve chunked array parsing significantly
2 parents 94a3a4c + 9a89664 commit c03c8db

File tree

7 files changed

+235
-395
lines changed

7 files changed

+235
-395
lines changed

README.md

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ A high performance javascript redis parser built for [node_redis](https://github
1111

1212
Install with [NPM](https://npmjs.org/):
1313

14-
```
15-
npm install redis-parser
16-
```
14+
npm install redis-parser
1715

1816
## Usage
1917

@@ -94,11 +92,57 @@ To handle protocol errors (this is very unlikely to happen) gracefully you shoul
9492

9593
The parser is highly optimized but there may still be further optimizations possible.
9694

97-
```
98-
npm install
99-
npm test
100-
npm run benchmark
101-
```
95+
npm install
96+
npm test
97+
npm run benchmark
98+
99+
Currently the benchmark compares the performance against the hiredis parser:
100+
101+
HIREDIS: $ multiple chunks in a bulk string x 867,643 ops/sec ±1.39% (82 runs sampled)
102+
HIREDIS BUF: $ multiple chunks in a bulk string x 591,398 ops/sec ±1.48% (83 runs sampled)
103+
JS PARSER: $ multiple chunks in a bulk string x 942,834 ops/sec ±0.87% (90 runs sampled)
104+
JS PARSER BUF: $ multiple chunks in a bulk string x 1,081,096 ops/sec ±1.81% (85 runs sampled)
105+
106+
HIREDIS: + multiple chunks in a string x 1,785,222 ops/sec ±0.59% (92 runs sampled)
107+
HIREDIS BUF: + multiple chunks in a string x 902,391 ops/sec ±1.62% (88 runs sampled)
108+
JS PARSER: + multiple chunks in a string x 1,936,709 ops/sec ±1.07% (90 runs sampled)
109+
JS PARSER BUF: + multiple chunks in a string x 1,954,798 ops/sec ±0.84% (91 runs sampled)
110+
111+
HIREDIS: $ 4mb bulk string x 344 ops/sec ±1.40% (85 runs sampled)
112+
HIREDIS BUF: $ 4mb bulk string x 555 ops/sec ±1.85% (80 runs sampled)
113+
JS PARSER: $ 4mb bulk string x 834 ops/sec ±1.23% (81 runs sampled)
114+
JS PARSER BUF: $ 4mb bulk string x 620 ops/sec ±2.40% (59 runs sampled)
115+
116+
HIREDIS: + simple string x 2,344,042 ops/sec ±1.45% (91 runs sampled)
117+
HIREDIS BUF: + simple string x 993,081 ops/sec ±1.87% (83 runs sampled)
118+
JS PARSER: + simple string x 4,431,517 ops/sec ±1.86% (88 runs sampled)
119+
JS PARSER BUF: + simple string x 5,259,552 ops/sec ±0.61% (96 runs sampled)
120+
121+
HIREDIS: : integer x 2,376,642 ops/sec ±0.30% (92 runs sampled)
122+
JS PARSER: : integer x 17,765,077 ops/sec ±0.53% (93 runs sampled)
123+
JS PARSER STR: : integer x 13,110,365 ops/sec ±0.67% (91 runs sampled)
124+
125+
HIREDIS: : big integer x 2,010,124 ops/sec ±0.87% (86 runs sampled)
126+
JS PARSER: : big integer x 10,277,063 ops/sec ±0.69% (91 runs sampled)
127+
JS PARSER STR: : big integer x 4,492,626 ops/sec ±0.67% (94 runs sampled)
128+
129+
HIREDIS: * array x 43,763 ops/sec ±0.84% (94 runs sampled)
130+
HIREDIS BUF: * array x 13,893 ops/sec ±1.05% (85 runs sampled)
131+
JS PARSER: * array x 50,825 ops/sec ±1.92% (80 runs sampled)
132+
JS PARSER BUF: * array x 72,546 ops/sec ±0.80% (94 runs sampled)
133+
134+
HIREDIS: * big array x 265 ops/sec ±1.46% (86 runs sampled)
135+
HIREDIS BUF: * big array x 226 ops/sec ±3.21% (75 runs sampled)
136+
JS PARSER: * big array x 201 ops/sec ±0.95% (83 runs sampled)
137+
JS PARSER BUF: * big array x 244 ops/sec ±2.65% (81 runs sampled)
138+
139+
HIREDIS: - error x 81,563 ops/sec ±0.51% (93 runs sampled)
140+
JS PARSER: - error x 155,225 ops/sec ±0.57% (95 runs sampled)
141+
142+
Platform info:
143+
Ubuntu 16.10
144+
Node.js 7.1.0
145+
Intel(R) Core(TM) i7-5600U CPU
102146

103147
## License
104148

0 commit comments

Comments
 (0)