Skip to content

Commit

Permalink
Avoid the slow path for end markers of size 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed May 14, 2017
1 parent eadac4a commit 4ca32ae
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions stream/vibe/stream/operations.d
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,17 @@ private void readUntilSmall(R, InputStream)(InputStream stream, ref R dst, in ub
stream.skip(pm.length);
} else {
dst.put(pm[0 .. idx]);
stream.skip(idx+1);
if (++nmatched == nmarker) return;
if (nmarker == 1) {
stream.skip(idx+1);
return;
} else if (idx+1 < pm.length && pm[idx+1] == marker[1]) {
assert(nmarker == 2);
stream.skip(idx+2);
return;
} else {
nmatched++;
stream.skip(idx+1);
}
}
}
}
Expand Down

0 comments on commit 4ca32ae

Please sign in to comment.