pomsky-lang / pomsky

A new, portable, regular expression language
https://pomsky-lang.org
Apache License 2.0
1.28k stars 19 forks source link

chore: Remove `divan::black_box` from benchmarks #100

Closed nvzqz closed 10 months ago

nvzqz commented 10 months ago

Description

The benchmarking code was calling black_box when:

Also, thanks for using Divan! I'm excited to see how folks are using it. ❤️

coveralls commented 10 months ago

Coverage Status

coverage: 79.696%. remained the same when pulling 1532d3e35c0a209fb806fddcb96ff35e86a792d0 on nvzqz:patch-1 into c8cef90453293e1b1ce30ed92f02c5e43dd3c62e on pomsky-lang:main.

Aloso commented 10 months ago

@nvzqz Thanks for taking a look, and for making divan!

I really like the clear output generated by divan, and how fast it is (criterion took several seconds for each benchmark).

By the way, is it possible to parameterize benchmarks by something other than numbers (e.g. strings)? I don't particularly like the macros I had to write.

nvzqz commented 10 months ago

I really like the clear output generated by divan, and how fast it is (criterion took several seconds for each benchmark).

Those two aspects were very intentional, thanks!

is it possible to parameterize benchmarks by something other than numbers (e.g. strings)? I don't particularly like the macros I had to write.

Not yet. I plan to support runtime parameters similar to the consts parameter:

#[divan::bench(args = ["a", "b", "c"])]
fn bench(s: &str) {
    ...
}

// or

#[divan::bench(args = ["a", "b", "c"])]
fn bench(b: Bencher, s: &str) {
    ...
}

Note that the arguments will be printed verbatim in the hierarchy using std::fmt::Display.

example
╰─ bench
   ├─ a
   ├─ b
   ╰─ c

So I recommend having them be either:

nvzqz commented 8 months ago

By the way, is it possible to parameterize benchmarks by something other than numbers (e.g. strings)? I don't particularly like the macros I had to write.

Divan now supports args like in my previous comment. 🙂