The Wire · Showcase
ELIXIR CORE SHIPS CALENDAR SPEED SWEEP, PHOENIX LIVE VIEW FIXES UI STALLS
By RepoJournal · Filed · About Elixir & Phoenix
Three precision optimizations land in Elixir core with 1.75x speedups on date and time comparisons, while Phoenix Live View plugs a bug that was freezing UI for 200ms on zero-duration transitions.
The Elixir team is aggressively optimizing hot paths in the standard library. Date.compare/2 and Time.compare/2 both hit ~1.75x speedup [2] [4] by replacing tuple unwraps with direct tuple comparison, and Calendar.ISO is getting exact fast paths for day fraction addition [3] [5] that eliminate expensive gcd operations when denominators divide evenly. Access.slice/1 got a parallel treatment, removing per-element protocol dispatch overhead [1] by destructuring the range once and using integer arithmetic instead. On the Phoenix Live View side, JS.hide(..., time: 0) was silently coercing valid zero values to 200ms, locking the UI and stalling pending server updates [6] [8], now fixed. A second fix ensures runtime hook scripts that get replaced during DOM patching correctly track the connected node for afterAdded callbacks [7].
One email a day. Unsubscribe in one click.
Keep up with Elixir & Phoenix in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Pull latest Elixir main; these optimizations ship in the next release and require zero code changes elixir-lang/elixir [plan]
- → If you use JS.hide with time: 0 in Live View, pull the fix to stop UI stalls phoenixframework/phoenix_live_view [immediate]
- → Review any runtime hook afterAdded callbacks; verify they're not relying on detached nodes phoenixframework/phoenix_live_view [monitor]
References
- [1] Replace protocol dispatch with arithmetic in Access.slice/1 ↗ elixir-lang/elixir
- [2] Optimize Time.compare/2 ↗ elixir-lang/elixir
- [3] perf: Add exact fast paths to Calendar.ISO.add_day_fraction_to_iso_days (#15759) elixir-lang/elixir
- [4] Optimize Date.compare/2 ↗ elixir-lang/elixir
- [5] perf: Add exact fast paths to Calendar.ISO.add_day_fraction_to_iso_da… ↗ elixir-lang/elixir
- [6] Preserve zero-duration JS transitions ↗ phoenixframework/phoenix_live_view
- [7] Fix runtime hook added node tracking ↗ phoenixframework/phoenix_live_view
- [8] Preserve zero-duration JS transitions (#4385) phoenixframework/phoenix_live_view