evanphx / benchmark-ips

Provides iteration per second benchmarking for Ruby
MIT License
1.72k stars 97 forks source link

Don't print error when printing standard deviation in comparison #110

Closed ivoanjo closed 1 year ago

ivoanjo commented 3 years ago

Hello there! Thanks a lot for benchmark-ips :)

Today I was using it for a few tests and noticed that whenever the percentage of standard deviation shows up in the comparison, it's always zero. E.g. with the example on the README.md I get:

Warming up --------------------------------------
            addition     2.390M i/100ms
           addition2     5.597M i/100ms
           addition3     5.260M i/100ms
addition-test-long-label
                         2.377M i/100ms
Calculating -------------------------------------
            addition     23.737M (± 3.0%) i/s -    119.519M in   5.040228s
           addition2     54.560M (± 3.0%) i/s -    274.271M in   5.031700s
           addition3     52.988M (± 1.8%) i/s -    268.258M in   5.064310s
addition-test-long-label
                         24.121M (± 1.3%) i/s -    121.248M in   5.027489s

Comparison:
           addition2: 54560399.9 i/s
           addition3: 52988283.5 i/s - same-ish: difference falls within error
addition-test-long-label: 24121165.9 i/s - 2.26x  (± 0.00) slower <-- zero?
            addition: 23736650.2 i/s - 2.30x  (± 0.00) slower <--- zero?

Every benchmark I also ran today always showed the (± 0.00) in the comparison. Is this expected?

I'm using benchmark-ips version 2.8.4, using different Ruby versions, on macOS.

nateberkopec commented 3 years ago

We don't calculate error for standard deviation, so this is expected.

Maybe we shouldn't bother printing it, though.

ivoanjo commented 3 years ago

I think it would be useful to still have the error for the values itself on the comparison, but yeah that's more of a separate feature, so yeah hiding the (± 0.00) sounds like the way to go here :)

kbrock commented 3 years ago

I think that is saying that this is basically close enough.

jtbg commented 1 year ago

as of release 2.11.0, standard deviation mode returns nil instead of zero for the error. (see #124)