tinylibs / tinybench

🔎 A simple, tiny and lightweight benchmarking library!
MIT License
1.73k stars 36 forks source link

Feature request: `name` field in `Bench` #81

Open colinhacks opened 4 months ago

colinhacks commented 4 months ago

I was writing a custom prettyprinter for tinybench and found myself wishing there was a way to attach a name field to a Bench instance.

new Bench({
  name: "my benchmark"
})

That way, I could have a self-contained logger function that I can pass a Bench instance into:

function myLogger(bench: Bench){
  console.log(bench.name);
  console.table(bench.table());
}

Happy to put in a PR if I get a greenlight from a maintainer 👍

Aslemammad commented 4 months ago

Let's have this one! 🚀 Feel free to.