JIT bitmap text rendering for microcontrollers
Proportionally spaced, kerned bitmap text on the RP2350 renders fast enough to race the beam by JIT-compiling each string into ARM Cortex-M33 code. The generated code extracts glyph rows from a tightly packed font bitmap into a 1bpp scanline buffer, and a second pass expands that buffer to RGB565. The font is packed so glyphs never straddle 32-bit words and overlapping glyphs share pixels. The JIT costs about 23 cycles per glyph, and generated code runs at roughly 3 cycles per glyph row. The whole text demo uses about 2.6% of one core, and kerning uses a two-byte-per-glyph "dot product" of left/right bitvectors evaluated with AND plus popcount.
Related posts
- Ruby 3.2’s YJIT is Production-Ready
Shopify Engineering easyNoviceYJIT, Shopify's JIT compiler for CRuby, became production-ready in Ruby 3.2 after a port from C99 to Rust and a cut in memory overhead to about a third of Ruby 3.1 levels. The memory savings came from smaller metadata, garbage collection of unused machine code and lazily allocated code pages. YJIT now runs about 38% faster than the 3.2 interpreter on railsbench and supports ARM64. Deployed across Shopify's entire Storefront Renderer, it delivers 5–10% end-to-end request speedups, and its fast compilation suits continuous deployment. Planned work targets memory footprint, faster method calls via a new calling convention and inlining, and a register allocator.
- Try Out YJIT for Faster Rubying
Shopify Engineering mediumAdeptYJIT, Shopify's just-in-time compiler built into CRuby and slated for Ruby 3.1, compiles frequently used Ruby code to native machine code, speeding up a simple Rails benchmark by 20% or more and a real Shopify web service by about 6% on canary traffic. Building it is the same as building CRuby from source: autoconf 2.69, OpenSSL 1.1 and a C toolchain, then enabling it with --enable-yjit or RUBY_YJIT_ENABLE=1. Compiling with YJIT_STATS or RUBY_DEBUG exposes detailed runtime statistics such as the share of instructions YJIT executed, generated code size and ISEQs compiled. YJIT passes Shopify's and GitHub's unit test suites but is still early, so the team asks users to report crashes and performance results.
- Leveraging Rust and the GPU to render user interfaces at 120 FPS
Zed hardMasterZed's GPUI framework hits 120 FPS by rendering the editor UI like a video game: rather than a general-purpose 2D vector renderer (Pathfinder proved too slow), it uses dedicated GPU shaders for a small set of primitives such as rectangles, shadows, text, icons and images, all described as data on the CPU and drawn with instanced rendering. Rounded rectangles come from a signed distance function evaluated in a Metal fragment shader. Drop shadows follow Evan Wallace's approximation, which pairs a closed-form erf-based Gaussian convolution on one axis with a few samples along the other. Text uses OS shaping via CoreText, with a per-frame cache of text-font pairs so only changed text gets reshaped.
- YJIT: Building a New JIT Compiler for CRuby
Shopify Engineering easyNoviceYJIT is a new JIT compiler built inside CRuby by Shopify and GitHub engineers, based on Basic Block Versioning, and aimed at real-world workloads like Rails where the GCC-based MJIT has struggled. After about a year it delivers speedups over the interpreter of 20% on railsbench, 39% on liquid template rendering and 37% on activerecord, with near-peak performance after one iteration. It passes CRuby's ~30,000 tests and the CI suites of Shopify Core and GitHub, and is slated to merge into Ruby 3.1. Only about 79% of railsbench instructions currently run in YJIT, and planned CRuby changes include object shapes, cheaper type tagging, finer-grained constant caching, a lighter calling convention, and rewriting C runtime methods in Ruby to enable inlining.
- Optimizing WebKit & Safari for Speedometer 3.0
WebKit hardMasterWebKit'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.