-
Notifications
You must be signed in to change notification settings - Fork 64
Reimplement Source::indexOf(ByteString) without Source::peek calls #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Here are benchmarking results (I executed benchmarks in throughput mode, so higher the score, better the performance): baseline (devel):
new version (this branch):
|
val peek = peek() | ||
if (!request(startIndex)) { | ||
return -1L | ||
while (request(offset + byteString.size)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just write an idea for the future: if a request appears, it may be worth adding a modification of the function to which fetchSize
can be passed. For example, it can help if byteString.size == 2
, so that there is no frequent reading of two bytes (which will most likely be slower than reading a large chunk)
As in #240, reimplemented algorithm without the use of the
PeekSource
. Also added a specialized implementation forBuffer
.