NodeRedis / node-redis-parser

A high performance Redis protocol (RESP) parser for JavaScript. Used by Node Redis & ioredis.
MIT License
88 stars 36 forks source link

Implement buffer growth multiplier #8

Closed rustyconover closed 8 years ago

rustyconover commented 8 years ago

When dealing with very large redis keys such as 328mb strings growing the buffer by 3 is very excessive. So if the request is for larger than 256kb, only grow the buffer by that amount.

BridgeAR commented 8 years ago

@rustyconover thanks for bringing this up. I indeed did not consider such huge buffers. Setting the multiplier alone would not have helped in this case though. The implementation I just pushed is actually a bit faster for big buffers than the former solution and works for the maximum possible typed array size (hiredis can't handle such big buffers btw), so this is a nice side effect :smile: