r/ruby • u/mavthemav • 14h ago
Grape 4.0.0 is out — ~80% faster than 3.3.5, plus HTTP QUERY (RFC 10008) support
I maintain Grape, the Ruby framework for REST-like APIs. 4.0.0 shipped today and it's the fastest yet.
Ruby 4.0.6, single-threaded Benchmark.ips :
| Version | No JIT | YJIT | ZJIT |
|---|---|---|---|
| 3.3.5 | 68,050 i/s | 133,833 i/s | 88,472 i/s |
| 4.0.0 | 122,414 i/s | 228,069 i/s | 153,183 i/s |
+80% without a JIT, +70% with YJIT. It's a micro-benchmark — one tiny JSON endpoint, in-process, no database — so it measures framework overhead and nothing else. Harness is in benchmark/version_throughput if you want to run it.
The biggest single win: helpers were being included into a fresh singleton class on every request, so every request started with a cold method cache. That now happens once, at compile time. TLDR: lot of improvements in terms of memory allocations.
Also new: QUERY (RFC 10008) — safe and idempotent like GET, but the query rides in the request content.
It's a major, so deprecated surface from 3.2 and 3.3 is gone.
Happy to answer questions.