Skip to content
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

Replace buffer individual byte peeking with indexOf(ByteString) #25

Open
JakeWharton opened this issue Jun 1, 2016 · 9 comments
Open
Milestone

Comments

@JakeWharton
Copy link

JakeWharton commented Jun 1, 2016

For example, this can be replaced with

private static final ByteString CDATA_CLOSE = ByteString.decodeUtf8("]]>");
// ...
long index = source.indexOf(CDATA_CLOSE);
if (index == -1) throw ...
return index;
@sockeqwe
Copy link
Contributor

sockeqwe commented Jun 1, 2016

Thanks for the hint. Does that makes any difference regarding performance?

Jake Wharton notifications@github.com schrieb am Mi., 1. Juni 2016, 16:56:

For example, this can be replaced with

private static final ByteString CDATA_CLOSE = ByteString.decodeUtf8("]]>");// ...long index = source.indexOf(CDATA_CLOSE);if (index == -1) throw ...return index;


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#25, or mute the thread
https://github.com/notifications/unsubscribe/AAjnrge7qhP1NcmGlZZSP6kbWWfsqubrks5qHZ2UgaJpZM4Iro3S
.

@JakeWharton
Copy link
Author

No. Just code reduction on your part.

@sockeqwe
Copy link
Contributor

sockeqwe commented Jun 1, 2016

👍

@FabianTerhorst
Copy link
Contributor

this could fix the issue with a json array inside cdata.

@sockeqwe sockeqwe added this to the 1.0 milestone Jun 27, 2016
@iNoles
Copy link
Contributor

iNoles commented Mar 26, 2017

Is this bug is still good?

@sockeqwe
Copy link
Contributor

It is, although it is not a bug. It's just for better code readability.

@iNoles
Copy link
Contributor

iNoles commented Mar 26, 2017

@FabianTerhorst
Copy link
Contributor

Its already replaced on this place.

@iNoles iNoles mentioned this issue Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants