Benchmarks

GretelX against gretel, on the same trails.

Rendering a trail

bench/render.rb renders the same five-level trail (Home > Customers > Alice > Orders > Order 2026-0042) with gretel and with GretelX, and checks that both produce the same output. The <ol> is gretel’s breadcrumbs(style: :ol) against a ten-line helper over breadcrumb_trail. The JSON-LD is gretel’s structured_data(url_base:) (paths behind a prefix) against breadcrumb_json_ld (_url helpers), both encoded and escaped the same way.

Ruby 4.0.9, Rails 8.1.4, gretel 5.1.0, Apple M5 (arm64 macOS), median of three runs of benchmark-ips
RenderAllocationsTime, YJIT offTime, YJIT on
gretel <ol>34557.6 µs35.1 µs
GretelX <ol>27445.4 µs29.8 µs
gretel JSON-LD26841.3 µs25.4 µs
GretelX JSON-LD28743.3 µs29.5 µs

Most of the JSON-LD gap comes from Rails’ _url helpers, which are slower than _path ones: building the BreadcrumbList from the levels accounts for 1.7 µs of it.

Running it again

From a checkout of the gem, once with YJIT off and once with it on:

bundle exec ruby bench/render.rb
bundle exec ruby --yjit bench/render.rb

Run each three times and keep the median. Numbers depend on the machine: compare the two gems on the same one, not against this table.