Enough java.lang.String to Hang Ourselves ...
summary
Shows measured JDK behaviors and concrete costs: JMH benchmarks and jcmd scans show + faster than StringBuilder since Java 9 for mixed concatenation, compact-strings use a byte[] with a coder so non‑Latin text can double memory, and a String+char[] pair often costs ~64 bytes so String Deduplication requires G1 and -XX:+UseStringDeduplication to save ~40 bytes per duplicate. Demonstrates a hash‑collision exploit where many zero‑hash strings make HashMap lookups linear and how Java 7 alt‑hashing and Java 8 tree bins mitigate it: hash-code-zero attack makes HashMap lookup linear.
AI-written summary · about
chapters (9)
- 0:00Start
- 6:25Java 1 1
- 16:07Java 1 4
- 19:43Compressed Strings
- 23:51Java 8
- 27:30Joining Strings
- 30:08Java 9
- 31:53Deduplication
- 34:38String Table
related talks
48mEnough java.lang.String to Hang Ourselves ...
46mEnough java.lang.String to Hang Ourselves...
40mWhat Every Java Programmer Should Know About Strings
09mString Enhancements in JDK 9
51mRethinking Java String Concatenation
01h 02mCompact Strings
40mSave Java memory
45mHow difficult can it be to write efficient code?
