Optimizing WebKit & Safari for Speedometer 3.0
WebKit's Speedometer 3.0 work spans JavaScriptCore, DOM, style, layout, rendering and Safari itself, with measured gains for each change. The largest wins came from letting the simple text path handle font-variant-caps (4.5x on Editor-TipTap, ~7% overall) and from scheduling incremental sweeping and garbage collection opportunistically between rendering updates (6.5% on Speedometer 3.0). Other changes include reworked megamorphic and call inline caches, retuned inlining heuristics, lazy JIT code destruction, enum-based RenderObject type checks, cached CSS custom property resolution, and a larger IOSurface cache (hit rate ~30% to ~80%). Profile-guided optimization interacts with code changes in a surprising way: some improvements only appear, or briefly regress, until the PGO profiles refresh.
Related posts
- Speedometer 2.1
WebKit mediumAdeptSpeedometer 2.1 is a minor update that fixes the benchmark harness so it no longer measures artificial timer throttling. The harness used nested setTimeout calls to capture deferred asynchronous work, but the deep nesting it built up triggered the spec-mandated 4ms throttle between callbacks, inflating measured work time. Inserting window.requestAnimationFrame before each test run resets the nesting level and isolates subtests better. Scores improved 3-5% in stable Safari, Chrome and Firefox.
- Speedometer 3.0: The Best Way Yet to Measure Browser Performance
WebKit mediumAdeptSpeedometer 3.0, jointly governed by Blink, Gecko and WebKit developers, changes how browser responsiveness is measured. Test scripts now run inside a requestAnimationFrame callback as "sync" time, and a zero-delay timer scheduled from a second rAF measures "async" time. Under the HTML5 event loop model, this ordering guarantees that rendering updates and rAF-deferred framework work are captured, which the old timer-only approach could miss. The workloads expand to TodoMVC apps in nine popular frameworks chosen from HTTP Archive and npm data, complex-DOM variants, Next.js/Nuxt news sites, SVG and canvas charting apps, and CodeMirror/TipTap editors. Scores are rescaled so a typical browser starts in the 20–30 range.
- Release Notes for Safari Technology Preview 253
WebKit mediumAdeptSafari Technology Preview 253 ships WebKit changes 320113@main through 321067@main for macOS Golden Gate and Tahoe. New features include global matching for style-originated scroll timelines, CSSContainerRule.conditions, sibling-index()/sibling-count() in container queries, safe/unsafe alignment with normal, BigInt support in Intl.PluralRules, and Toom-3 multiplication for large BigInts. Fixes cover CSS grid track sizing, list markers, corner-shape rendering, and interpolation. JavaScriptCore fixes address inline-cache invalidation, regex /v mode and lookbehind surrogate handling, and JIT bounds-check elimination. Further fixes touch media, networking (HTTP header validation, 2GB Blob overflow), and performance (IntersectionObserver CPU use, long-URL parsing hangs).
- New WebKit Features in Safari 14.1
WebKit mediumAdeptSafari 14.1 (macOS Big Sur, iOS/iPadOS 14.5) ships Flexbox gap, macOS date/time inputs, CSS individual transform properties, the Paint Timing API, Siri-backed Web Speech recognition, an unprefixed Web Audio API with Audio Worklets, MediaRecorder, and WebM (VP8/VP9/Vorbis) playback on macOS. JavaScriptCore adds private and static class fields, new Intl APIs (DisplayNames, ListFormat, Segmenter), and WeakRef/FinalizationRegistry. WebAssembly gains threading atomics (shared memory stays disabled until COOP/COEP support, because of Spectre risk), sign-extension ops, and BigInt-to-i64 conversion. Wheel handlers registered on window, document or body now default to passive, so pages that need to block trackpad gestures must call preventDefault() on the first wheel event. The release also brings Private Click Measurement, Storage Access API updates, and Web Inspector improvements.
- WebKit Features in Safari 17.5
WebKit mediumAdeptSafari 17.5 ships seven features and 22 bug fixes, led by CSS additions: text-wrap: balance (with the text-wrap-style longhand), the light-dark() color function, @starting-style for entry transitions, and supports() conditions on @import rules. WebKit balances an unlimited number of lines, versus 6 in Chromium and 10 in Firefox, but skips balancing around floats, initial letters, preserved tabs and soft hyphens. Unsupported text-wrap values fall back to auto, so they are safe to use as progressive enhancement. The release also adds AV1 in WebCodecs when a hardware decoder is available, two WebGL extensions, and fixes across accessibility, media, rendering, Web Push and WebRTC.