The Lord of the Strings: Two Scours
summary
Two JDK9 features target strings: Compact Strings stores Latin-only strings in byte arrays with a one-byte coder flag, preserving charAt O(1) and cutting heap footprint roughly in half while improving throughput about 1.7–1.8x on microbenchmarks; Indify String Concat replaces generated StringBuilder chains with invokedynamic-backed concat strategies that can boost some concat-heavy workloads up to ~3.5x and, combined with compact strings, yield ~80–90% win in memory and overall performance. Prototypes exist but require VM, bootstrap and compatibility hacks to land.
AI-written summary · about
chapters (14)
- 0:00Introduction and disclaimer
- 0:25Compact Strings overview
- 7:13Challenges in implementation
- 15:30Stop gap for Compact Strings
- 21:59Static final field issues
- 27:46Bootstrap problems
- 32:46Array size limits
- 36:34Byte-to-char conversion
- 42:17StringBuilder and concatenation
- 49:23invokedynamic for concatenation
- 53:36invokedynamic startup cost
- 57:34Combining features
- 1:00:07Performance results
- 1:01:36Conclusion and Q&A
