CodeName OneShai Almog20 min readintermediate
Lies, Damn Lies and Benchmarks
Summary
Codename One engineers dissect why benchmark numbers can be misleading, then share concrete work on GC tuning, proper weak/soft references, and a new probing sequence for their open‑addressed HashMap that cuts miss‑probe counts from >16 k to ~1.5 per lookup.
- Benchmarks that only measure happy‑path cases (e.g., existing‑key lookups) can hide pathological behavior such as massive probe counts for missing keys.
- Lowering the GC trigger floor from 24 MB to 38 MB RSS reduced resident memory without hurting throughput; the default live‑set estimate was incomplete, so a simple compile‑time constant now lets deployments pick a lower…
- Implemented true weak and soft references in ParparVM; soft references now age‑out based on last successful get(), improving cache hit‑rate to 97.44 % at 82 MB RSS versus 87.99 % at 91 MB with the previous pressure‑base…
- Replaced the default linear‑probing sequence in Codename One’s HashMap with CPython‑style perturbation probing, preserving the fast first‑probe for dense keys while reducing miss probes from ~16 k to ~1.5 and cutting mi…
Real‑world mobile apps care about startup latency, memory footprint, and smooth UI rendering. Mis‑leading benchmarks can lead developers to ship apps that perform well in synthetic tests but stall on edge cases. The article’s concrete GC and hashmap improvements directly translate to lower RAM usag…
7/10
