-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix stream overconsumption by undoing readahead via seek when possible #50
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
986aef5
to
f6f036a
Compare
dfd74cc
to
7396e2e
Compare
699faf8
to
3ce611a
Compare
smheidrich
added a commit
to smheidrich/json-stream
that referenced
this pull request
Dec 25, 2022
Proof of concept only. Maybe there is a more elegant solution that doesn't require putting `level` everywhere to find out when the top-level document ends. Requires smheidrich/py-json-stream-rs-tokenizer#50 to be merged to actually work.
This was referenced Dec 25, 2022
16a61fd
to
3172869
Compare
173789e
to
c22bff9
Compare
c22bff9
to
a5225c0
Compare
Pretty horrible fix that slows things down tremendously (speedup lowered from ~10 to ~2-3).
These issues remain: - seeking from the chunk start position instead of the very beginning of the stream doesn't work yet as there is nothing that resets the char counter when a new read() is performed - there must be some bug regarding re-initializing the BufReader after a readahead-undo (park_cursor() in the code) has been performed, because subsequent uses of this BufReader will yield wrong chars (visible e.g. in tests on random data like in the benchmarks but there should be an explicit test inside Rust instead) - only Python text streams are supported, none of this garbage will work for Python byte streams
Remaining issues: - get it to work for byte streams - clean up Rust warnings - remove unused code - look into degraded performance (speedup now only 8...), e.g. try to zero-copy strings from Python by putting them in refcells or sth. - handle case of non-seekable stream
Fixes performance degradation issue (lol...)
No switch to choose text/bytes yet => up next.
Also add unseekable text stream file I missed before
a5225c0
to
ea44f7e
Compare
Avoids collisions with parameters introduced by json-stream's Python tokenizer.
b0f2123
to
890fffa
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #47 when done