← Graph

Sorbet signatures are free; assertions are not

takeaway 2 connections

Key performance insight from Erwin Kroon's measurements at GitHub. Depending on Sorbet's startup configuration, method signatures can be erased entirely — zero runtime cost, so write as many as you like. Type assertions (T.let, T.cast, T.must, even T.unsafe) remain in the bytecode and can't be optimized by YJIT. Micro-benchmarks showed ~4× overhead for the assertion calls themselves versus code without them, though overall Sorbet overhead at GitHub measured ~1.5–2% (masked by DB time). Conclusion: prefer signatures, avoid leaning on assertions.

type
insight
takeaway Sorbet signatures are free; assertions are not
about
Sorbet tool
Performance insight about Sorbet runtime behavior.
takeaway Sorbet signatures are free; assertions are not
from_talk
Performance insight from speaker's benchmarks.

Provenance