public class SunMiscUTF8Encoder extends Object implements UTF8Encoder
1) There's no way using public APIs to do GC-free string encoding unless you build a custom encoder, and GC output from UTF-8 encoding causes production instability 2) The ArrayEncoder provided by HotSpot is 2 orders faster for UTF-8 encoding for a massive amount of real-world strings due to specialized handling of ascii, and we can't import that since we need to compile on IBM J9
We can't solve (1) without solving (2), because the default GC-spewing String#getBytes() uses the optimized ArrayEncoder, meaning it's easy to write an encoder that is GC-free, but then it'll be two orders slower than the stdlib, and vice versa.
This solves both issues using MethodHandles. Future work here could include writing a custom UTF-8 encoder (which could then avoid using ArrayEncoder), as well as stopping use of String's for the main database paths. We already have Token, which could easily contain pre-encoded UTF-8 data, and "runtime" Strings could be handled with a custom type that is more stability friendly, for instance by building on to StringProperty.
| Constructor and Description |
|---|
SunMiscUTF8Encoder() |
| Modifier and Type | Method and Description |
|---|---|
ByteBuffer |
encode(String input) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfastestAvailableEncoderpublic ByteBuffer encode(String input)
encode in interface UTF8EncoderCopyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.