The Wayback Machine - https://web.archive.org/web/20200907031328/https://github.com/json-iterator/java/pull/166
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

[WIP] Fully-functional Slices #166

Open
wants to merge 4 commits into
base: master
from
Open

Conversation

@Miha-x64
Copy link
Contributor

Miha-x64 commented Mar 4, 2018

Slices may be always used instead of Strings.
They can be read fast way, when there are no multibyte chars or escape sequences, or slow way, with String allocation.

Not done yet: String deduplication (less allocations), especially when parsing big lists of objects with similar structure.

Miha-x64 added 2 commits Mar 4, 2018
… or multibyte chars, or will allocate a String and return a StringSlice
@taowen
Copy link
Contributor

taowen commented Mar 5, 2018

slice is good when the input is byte array, and there is not unicode or escape. when the input is a input stream, the allocation can not be avoided.

Miha-x64 added 2 commits Mar 5, 2018
@Miha-x64
Copy link
Contributor Author

Miha-x64 commented Mar 6, 2018

In your variant reading slices may not succeed. For example, enum decoder reads a Slice without any fallback. But enum constant may contain non-unicode characters, while, for instance, PHP's json_encode function encodes such characters using \uXXXX.

@Miha-x64
Copy link
Contributor Author

Miha-x64 commented Mar 11, 2018

Very strange. Tests, failing on Travis, are working correctly on my computer. Except ones with Streaming Category which failing on enableStreamingSupport with Javassist errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.