What's Today

Hacker News Front Page · Bartek Płotka ·

benchfmt.rs: Bringing Go's Benchmarking and benchstat Workflow to Rust

benchfmt.rs traslada a Rust el flujo de benchmarks de Go y benchstat: ofrece ejecución con épocas de duración estable, medición de asignaciones y bytes, soporte de pprof y conversión de resultados de Criterion. En las pruebas descritas, Rust fue entre un 14,7 % y un 42,6 % más rápido que Go en dos decodificadores, aunque la decodificación de Remote Write 2.0 usó entre un 31 % y un 43 % más bytes asignados; el perfilado atribuye buena parte de esa diferencia al crecimiento de vectores en prost. El autor también contrasta los microbenchmarks con binarios independientes y explica cómo elegir entre el conversor de Criterion y la API de benchmarks propia.

TL;DR: I built benchfmt.rs, a zero-dependency Rust benchmark runner and Criterion converter for Go’s benchstat. It adds /key=value projections, heap tracking for allocated bytes (B/op) and objects (allocs/op) per op, and pprof profiling. In this post, I am benchmarking varint and Prometheus Remote Write 2.0 decoding across Go and Rust to showcase the benefits of benchstat-like flow in Rust. I’m also sharing some fun learnings on the way (e.g., yes Rust is faster).

Leer la nota completa en www.bwplotka.dev →