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

Improve performance of BinaryTagIO by buffering and clarify stream closing #98

Merged
merged 2 commits into from
Jul 17, 2020

Conversation

astei
Copy link
Contributor

@astei astei commented Jul 12, 2020

While looking at adventure-nbt I spotted two issues:

  • Lack of stream buffering. This can hurt performance, especially for compressed NBT and slow disks.
  • BinaryTagIO will indiscriminately close streams given to it. For single-shot cases or reading from a in-memory buffer this isn't an issue, but if (say) you were parsing a set of NBT streams this could be an issue.

To fix this:

  • Path-taking methods and *Compressed* methods now buffer the relevant streams (I assume if you're passing in an InputStream or a DataInput directly that you know what you're doing)
  • Added code so that BinaryTagIO won't close streams it is given

Still a bit of a WIP (need to write tests), but wanted to get this up here.

Copy link
Member

@zml2008 zml2008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kashike kashike added this to the 4.0.0 milestone Jul 17, 2020
@kashike kashike self-assigned this Jul 17, 2020
@kashike kashike merged commit 1277687 into KyoriPowered:master Jul 17, 2020
zml2008 pushed a commit that referenced this pull request Dec 7, 2021
also some cleanup of the last stuff

Signed-off-by: MiniDigger <admin@minidigger.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants