airhacks.fm podcast with adam bien· Folge 410

Turning Back Time: Strings, Locks and Garbage Collectors in Java

Donnerstag, 27. August 2026 · 1 h 01

MP3

Shownotes

An airhacks.fm conversation with Ian Rogers (linkedin.com/in/irogers) about:
Java's early API design strengths versus verbose C++/STL manuals,
the Java 7 (en.wikipedia.org/wiki/Java_version_history#Jav…) String.substring (docs.oracle.com/javase/8/docs/api/java/lang/St…) behavior change from an O(1) view over the character array to an O(n) copy,
substring performance regressions at Google,
implementing a custom substring as a workaround,
designing APIs without knowing future customers,
the SPEC JVM98 (spec.org/jvm98) jack parser generator throwing an exception per matched token,
exceptions used for control flow violating the exceptions-are-exceptional principle,
JVM benchmarks skewed toward fast exception throwing,
ANTLR (antlr.org) and JavaCC (javacc.github.io/javacc) as later parser tools,
class loaders pairing a type with a runtime notion,
docs.oracle.com/javase/8/docs/api/java/lang/Cl… thrown from nested jar files,
the DaCapo benchmark (dacapobench.org) as a test of exception-throwing speed,
Effective Java (en.wikipedia.org/wiki/Effective_Java) advice to return interfaces such as Map instead of HashMap,
why substring should have returned docs.oracle.com/javase/8/docs/api/java/lang/Ch…,
the argument that String should be an interface and CharSequence the concrete type,
CharSequence length limited to int and capped at 2GB,
Guava (github.com/google/guava) en.wikipedia.org/wiki/Rope_(data_structure) as a collection of CharSequences unable to implement CharSequence because of the int length limit,
signed versus unsigned sizing of arrays and strings,
byte signed and char unsigned inconsistencies,
docs.oracle.com/javase/8/docs/api/java/lang/St… versus docs.oracle.com/javase/8/docs/api/java/lang/St…,
the race condition avoided by StringBuilder cloning its array in toString,
StringBuffer passing array ownership under a lock,
biased locking (en.wikipedia.org/wiki/Java_performance) making uncontended locks cheap,
the Attack of the Clones problem of defensive cloning,
optimizing clones away in the JVM,
transactional memory (en.wikipedia.org/wiki/Transactional_memory) as an alternative to locking,
copy-on-write (en.wikipedia.org/wiki/Copy-on-write) and CopyOnWriteArrayList,
Swift copy-on-write,
Linux kernel (en.wikipedia.org/wiki/Linux_kernel) read-copy-update (en.wikipedia.org/wiki/Read-copy-update) and epochs,
writing the Azul C4 garbage collector (azul.com/products/components/pgc),
the C4 read barrier now used in ZGC (wiki.openjdk.org/spaces/zgc/pages/34668579/Main) and Shenandoah (wiki.openjdk.org/spaces/shenandoah/pages/25002…),
moving Azul (azul.com) from custom hardware read-barrier instructions to x86,
the two-space invariant in concurrent copying collectors,
IBM Metronome fixups versus two-space invariants,
detecting same-page references by XOR of two pointers,
trading computation for memory accesses in read barriers,
the Transitive Corporation (en.wikipedia.org/wiki/Transitive_Corporation) binary translator,
en.wikipedia.org/wiki/Rosetta_(software) for Apple and a Sparc-to-Power translator behind IBM's planned en.wikipedia.org/wiki/Sun_Microsystems acquisition,
writing Android Runtime ART (source.android.com/docs/core/runtime),
ahead-of-time compilation of Dex replacing en.wikipedia.org/wiki/Dalvik_(software),
disk-size constraints of AOT (en.wikipedia.org/wiki/Ahead-of-time_compilation) compilation,
Hans Boehm (hboehm.info) and sticky mark bits (en.wikipedia.org/wiki/Tracing_garbage_collection) for generational marking without moving objects,
ART generational concurrent garbage collection in Android KitKat,
HashMap interface dispatch replacing LinkedList iteration from JikesRVM (jikesrvm.org),
alphabetically sorted interfaces putting AbstractCollection first,
Google Maps interface dispatch consuming half the frame time,
frame-rate and pause-time gains from ART,
en.wikipedia.org/wiki/WhatsApp broken by an unbalanced-lock bytecode obfuscator,
balanced locks required for biased locking,
thread safety annotations in Clang/LLVM (clang.llvm.org/docs/ThreadSafetyAnalysis.html) guarding the Java heap,
the mutator lock and stale pointer risks,
a reader-writer lock model of the Java heap,
managing risk when replacing an operating system runtime,
en.wikipedia.org/wiki/CyanogenMod as a delivery path for ART,
Project Valhalla (openjdk.org/projects/valhalla) value types,
current work on the Linux perf tool (perfwiki.github.io/main) and observability,
en.wikipedia.org/wiki/OProfile origins,
GPU versus CPU visibility in system tools

Ian Rogers on linkedin: linkedin.com/in/irogers

0:00 / 0:00