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

Implement faster "ascii" character set #24

Closed
gbrail opened this issue Nov 25, 2013 · 3 comments
Closed

Implement faster "ascii" character set #24

gbrail opened this issue Nov 25, 2013 · 3 comments

Comments

@gbrail
Copy link
Contributor

gbrail commented Nov 25, 2013

We use the built-in character set conversions in Java for all string encoding and decoding. This works great for lots of character sets, but for ASCII it is quite pedantic in the way that it checks for valid and invalid characters. Native Node, on the other hand, appears to just lop off every byte and cast it directly to an ASCII character, with no validation.

Looking at benchmark results, Trireme suffers more than usual against Node when ASCII characters are used. We should see if implementing a "dumber" version of the ASCII character set from Java would speed these up and make them more compatible with native Node.

@gbrail
Copy link
Contributor Author

gbrail commented Jun 5, 2014

Messed around with some microbenchmarks in Caliper and the built-in "ascii" encoding and decoding are quite a bit more efficient than what I can build myself.

@gbrail
Copy link
Contributor Author

gbrail commented Jun 21, 2014

Lots of string encoding and decoding in Trireme depends on careful handling of missing characters and partial multi-byte characters, so a simple swap to "getBytes" and "new String" is not going to be sufficient. However we switched a few obvious spots and will switch more as time goes on.

@gbrail
Copy link
Contributor Author

gbrail commented Jul 19, 2014

Fixed in 0.8.0.

@gbrail gbrail closed this as completed Jul 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant