Skip to content

Commit a56a893

Browse files
author
Ruben Bridgewater
committed
chore(benchmark): Update big nested array benchmark to more realistic data
1 parent b92c275 commit a56a893

File tree

2 files changed

+47
-46
lines changed

2 files changed

+47
-46
lines changed

README.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -108,50 +108,50 @@ The parser is highly optimized but there may still be further optimizations poss
108108

109109
Currently the benchmark compares the performance against the hiredis parser:
110110

111-
HIREDIS: $ multiple chunks in a bulk string x 867,643 ops/sec ±1.39% (82 runs sampled)
112-
HIREDIS BUF: $ multiple chunks in a bulk string x 591,398 ops/sec ±1.48% (83 runs sampled)
113-
JS PARSER: $ multiple chunks in a bulk string x 942,834 ops/sec ±0.87% (90 runs sampled)
114-
JS PARSER BUF: $ multiple chunks in a bulk string x 1,081,096 ops/sec ±1.81% (85 runs sampled)
115-
116-
HIREDIS: + multiple chunks in a string x 1,785,222 ops/sec ±0.59% (92 runs sampled)
117-
HIREDIS BUF: + multiple chunks in a string x 902,391 ops/sec ±1.62% (88 runs sampled)
118-
JS PARSER: + multiple chunks in a string x 1,936,709 ops/sec ±1.07% (90 runs sampled)
119-
JS PARSER BUF: + multiple chunks in a string x 1,954,798 ops/sec ±0.84% (91 runs sampled)
120-
121-
HIREDIS: $ 4mb bulk string x 344 ops/sec ±1.40% (85 runs sampled)
122-
HIREDIS BUF: $ 4mb bulk string x 555 ops/sec ±1.85% (80 runs sampled)
123-
JS PARSER: $ 4mb bulk string x 834 ops/sec ±1.23% (81 runs sampled)
124-
JS PARSER BUF: $ 4mb bulk string x 620 ops/sec ±2.40% (59 runs sampled)
125-
126-
HIREDIS: + simple string x 2,344,042 ops/sec ±1.45% (91 runs sampled)
127-
HIREDIS BUF: + simple string x 993,081 ops/sec ±1.87% (83 runs sampled)
128-
JS PARSER: + simple string x 4,431,517 ops/sec ±1.86% (88 runs sampled)
129-
JS PARSER BUF: + simple string x 5,259,552 ops/sec ±0.61% (96 runs sampled)
130-
131-
HIREDIS: : integer x 2,376,642 ops/sec ±0.30% (92 runs sampled)
132-
JS PARSER: : integer x 17,765,077 ops/sec ±0.53% (93 runs sampled)
133-
JS PARSER STR: : integer x 13,110,365 ops/sec ±0.67% (91 runs sampled)
134-
135-
HIREDIS: : big integer x 2,010,124 ops/sec ±0.87% (86 runs sampled)
136-
JS PARSER: : big integer x 10,277,063 ops/sec ±0.69% (91 runs sampled)
137-
JS PARSER STR: : big integer x 4,492,626 ops/sec ±0.67% (94 runs sampled)
138-
139-
HIREDIS: * array x 43,763 ops/sec ±0.84% (94 runs sampled)
140-
HIREDIS BUF: * array x 13,893 ops/sec ±1.05% (85 runs sampled)
141-
JS PARSER: * array x 50,825 ops/sec ±1.92% (80 runs sampled)
142-
JS PARSER BUF: * array x 72,546 ops/sec ±0.80% (94 runs sampled)
143-
144-
HIREDIS: * big array x 265 ops/sec ±1.46% (86 runs sampled)
145-
HIREDIS BUF: * big array x 226 ops/sec ±3.21% (75 runs sampled)
146-
JS PARSER: * big array x 201 ops/sec ±0.95% (83 runs sampled)
147-
JS PARSER BUF: * big array x 244 ops/sec ±2.65% (81 runs sampled)
148-
149-
HIREDIS: - error x 81,563 ops/sec ±0.51% (93 runs sampled)
150-
JS PARSER: - error x 155,225 ops/sec ±0.57% (95 runs sampled)
111+
HIREDIS: $ multiple chunks in a bulk string x 859,880 ops/sec ±1.22% (82 runs sampled)
112+
HIREDIS BUF: $ multiple chunks in a bulk string x 608,869 ops/sec ±1.72% (85 runs sampled)
113+
JS PARSER: $ multiple chunks in a bulk string x 910,590 ops/sec ±0.87% (89 runs sampled)
114+
JS PARSER BUF: $ multiple chunks in a bulk string x 1,299,507 ops/sec ±2.18% (84 runs sampled)
115+
116+
HIREDIS: + multiple chunks in a string x 1,787,203 ops/sec ±0.58% (96 runs sampled)
117+
HIREDIS BUF: + multiple chunks in a string x 943,584 ops/sec ±1.62% (87 runs sampled)
118+
JS PARSER: + multiple chunks in a string x 2,008,264 ops/sec ±1.01% (91 runs sampled)
119+
JS PARSER BUF: + multiple chunks in a string x 2,045,546 ops/sec ±0.78% (91 runs sampled)
120+
121+
HIREDIS: $ 4mb bulk string x 310 ops/sec ±1.58% (75 runs sampled)
122+
HIREDIS BUF: $ 4mb bulk string x 471 ops/sec ±2.28% (78 runs sampled)
123+
JS PARSER: $ 4mb bulk string x 747 ops/sec ±2.43% (85 runs sampled)
124+
JS PARSER BUF: $ 4mb bulk string x 846 ops/sec ±5.52% (72 runs sampled)
125+
126+
HIREDIS: + simple string x 2,324,866 ops/sec ±1.61% (90 runs sampled)
127+
HIREDIS BUF: + simple string x 1,085,823 ops/sec ±2.47% (82 runs sampled)
128+
JS PARSER: + simple string x 4,567,358 ops/sec ±1.97% (81 runs sampled)
129+
JS PARSER BUF: + simple string x 5,433,901 ops/sec ±0.66% (93 runs sampled)
130+
131+
HIREDIS: : integer x 2,332,946 ops/sec ±0.47% (93 runs sampled)
132+
JS PARSER: : integer x 17,730,449 ops/sec ±0.73% (91 runs sampled)
133+
JS PARSER STR: : integer x 12,942,037 ops/sec ±0.51% (92 runs sampled)
134+
135+
HIREDIS: : big integer x 2,012,572 ops/sec ±0.33% (93 runs sampled)
136+
JS PARSER: : big integer x 10,210,923 ops/sec ±0.94% (94 runs sampled)
137+
JS PARSER STR: : big integer x 4,453,320 ops/sec ±0.52% (94 runs sampled)
138+
139+
HIREDIS: * array x 44,479 ops/sec ±0.55% (94 runs sampled)
140+
HIREDIS BUF: * array x 14,391 ops/sec ±1.04% (86 runs sampled)
141+
JS PARSER: * array x 53,796 ops/sec ±2.08% (79 runs sampled)
142+
JS PARSER BUF: * array x 72,428 ops/sec ±0.72% (93 runs sampled)
143+
144+
HIREDIS: * big nested array x 217 ops/sec ±0.97% (83 runs sampled)
145+
HIREDIS BUF: * big nested array x 255 ops/sec ±2.28% (77 runs sampled)
146+
JS PARSER: * big nested array x 242 ops/sec ±1.10% (85 runs sampled)
147+
JS PARSER BUF: * big nested array x 375 ops/sec ±1.21% (88 runs sampled)
148+
149+
HIREDIS: - error x 78,821 ops/sec ±0.80% (93 runs sampled)
150+
JS PARSER: - error x 143,382 ops/sec ±0.75% (92 runs sampled)
151151

152152
Platform info:
153153
Ubuntu 16.10
154-
Node.js 7.1.0
154+
Node.js 7.4.0
155155
Intel(R) Core(TM) i7-5600U CPU
156156

157157
## License

benchmark/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,15 @@ for (i = 0; i < arraySize; i++) {
6262

6363
var arrayBuffer = new Buffer(array)
6464

65-
var bigArraySize = 1000
66-
var bigArrayChunks = [new Buffer('*1\r\n*1\r\n*' + bigArraySize * 2)]
65+
var bigArraySize = 160
66+
var bigArrayChunks = [new Buffer('*1\r\n*1\r\n*' + bigArraySize)]
6767
for (i = 0; i < bigArraySize; i++) {
68-
size = (Math.random() * 10000 | 0)
68+
// A chunk has a maximum size of 2^16 bytes.
69+
size = 65000 + i
6970
if (i % 2) {
70-
bigArrayChunks.push(new Buffer('\r\n$' + size + '\r\n' + Array(size + 1).join('a') + '\r\n:' + size))
71+
bigArrayChunks.push(new Buffer('\r\n$' + size + '\r\n' + Array(size + 1).join('a') + '\r\n:' + (Math.random() * 1000000 | 0)))
7172
} else {
72-
bigArrayChunks.push(new Buffer('\r\n+' + Array(size + 1).join('b') + '\r\n:' + size))
73+
bigArrayChunks.push(new Buffer('\r\n+this is some short text about nothing\r\n:' + size + '\r\n$' + size + '\r\n' + Array(size + 1).join('b')))
7374
}
7475
}
7576
bigArrayChunks.push(new Buffer('\r\n'))

0 commit comments

Comments
 (0)