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

perf(java): fix fury input stream read slow #1551

Merged
merged 1 commit into from
Apr 20, 2024

Conversation

chaokunyang
Copy link
Collaborator

What does this PR do?

This PR fix fury input stream read slow.

Related issues

Closes #1548

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

  • Before this PR: cost 18031 mills
  • With this PR: cost 1441mills
  public static void main(String[] args) throws IOException {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    ZstdOutputStream zstdOutputStream = new ZstdOutputStream(outputStream);
    FURY_RELEASE.serializeJavaObject(zstdOutputStream, BeanA.createBeanA(20));
    byte[] bytes = outputStream.toByteArray();
    long start = System.currentTimeMillis();
    for (int i = 0; i < 10000; i++) {
      zstdFuryDeserialize_Snapshot(new ByteArrayInputStream(bytes), BeanA.class);
    }
    System.out.println(System.currentTimeMillis() - start);
     start = System.currentTimeMillis();
    for (int i = 0; i < 10000; i++) {
      zstdFuryDeserialize_Snapshot(new ByteArrayInputStream(bytes), BeanA.class);
    }
    System.out.println(System.currentTimeMillis() - start);
  }

Copy link
Contributor

@LiangliangSui LiangliangSui left a comment

Choose a reason for hiding this comment

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

Great!

@theweipeng theweipeng merged commit f246aaf into apache:main Apr 20, 2024
32 checks passed
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

Successfully merging this pull request may close these issues.

[Java] Performance issue when deserializing from FuryInputStream with ZstdInputStream
3 participants