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

feat: use TextDecoder to decode buffer #1699

Merged
merged 2 commits into from
Jul 3, 2024
Merged

feat: use TextDecoder to decode buffer #1699

merged 2 commits into from
Jul 3, 2024

Conversation

bytemain
Copy link
Contributor

What does this PR do?

Use the browser builtin decode utils: TextDecoder

https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder

This can improve a lot of performance. see the diff of the benchmark.

and the original implementation will cause many minor gc in javascript, the longer the string, the longer the GC time.

Related issues

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

CleanShot 2024-06-25 at 17 04 45@2x

@bytemain bytemain requested a review from theweipeng as a code owner June 25, 2024 09:05
Copy link
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

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

Awesome!

@theweipeng theweipeng merged commit d25ccbb into apache:main Jul 3, 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.

3 participants