Commit ecd64bb5 authored by Arnout Kazemier's avatar Arnout Kazemier

Merge pull request #205 from ageitgey/work-around-v8-GC-issue

Workaround an issue in v8 that makes retrieving keys very slow for certain key sizes
parents 886826c2 30edad49
......@@ -645,6 +645,14 @@ Client.config = {
// only call transform the data once we are sure, 100% sure, that we valid
// response ending
if (S.responseBuffer.substr(S.responseBuffer.length - 2) === LINEBREAK) {
// Force v8 to re-allocate the responseBuffer and free the BufferStream
// chunks that were appended to it. This works around an issue in v8 where
// it doesn't free the appended strings which can cause poor GC behavior
// and make this function very slow for larger key values.
// See: https://code.google.com/p/v8/issues/detail?id=2869
S.responseBuffer = (' ' + S.responseBuffer).substr(1);
var chunks = S.responseBuffer.split(LINEBREAK);
if (this.debug) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment