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

[Java] Fast string serialization support #89

Closed
chaokunyang opened this issue May 7, 2023 · 0 comments · Fixed by #90
Closed

[Java] Fast string serialization support #89

chaokunyang opened this issue May 7, 2023 · 0 comments · Fixed by #90

Comments

@chaokunyang
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
String is very common in serialization, but due to its variable length and mutiple encoding, string serialization is pretty slow, sometimes is becomes the bottle of whole serialization. We need a way for fast string serialization.

The bottle mainly consists of:

  • String data serialization copy: copy inner char[] / byte[] outside for serialization.
  • String encoding: encoding char[] / byte[] into ascii/unicode16/utf8
  • String decoding: decoding binary into ascii/unicode16 char[]/byte[]
  • String creation copy cost: java.lang.String will copy provided char[]/byte[] for immutability.

Describe the solution you'd like

  • Use sun.misc.Unsafe for extract inner char[] / byte[]
  • Support ascii/unicode16/utf8 to minimize encoding cost
  • Add encoding flag in data to support multiple encoding
  • Use java.lang.invoke.MethodHandle to avoid invoke package-level zero0-copy constructor with minimal cost
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 a pull request may close this issue.

1 participant