bencheeorg / benchee

Easy and extensible benchmarking in Elixir providing you with lots of statistics!
MIT License
1.42k stars 66 forks source link

make example work when pasted into the console #270

Closed ghost closed 5 years ago

ghost commented 5 years ago

arguably less beautiful but copy-n-paste friendly

devonestes commented 5 years ago

Thanks for the input @bryanhuntesl!

Personally, I think the majority of the value in our documentation is as something to read, not something to copy and paste into the console, so I think it's smart to err on the side of what folks would expect to read. Since the Elixir formatter would format that code (almost) as we have it now, I would prefer to keep it as it, but I'll wait for @PragTob to weigh in as well before we make the final call here.

PragTob commented 5 years ago

@devonestes is spot on here imo. Formatting all samples in samples and then also in the README is actually something I'd like to do :)

I'd just like to add that benchmarking in the console is highly discouraged - it's not your actual environment, performance characteristics might be different. Not sure we're clear on that in the README but yeah one shouldn't. So in that sense, it'd be the wrong affordance imo.

Thanks a lot for your contribution though @bryanhuntesl !

test is/was a small flaky:

  1) test .run_scenarios very fast function times are almost 0 with function call overhead elimination (Benchee.Benchmark.RunnerTest)
     test/benchee/benchmark/runner_test.exs:185
     Assertion with <= failed
     code:  assert median <= 60
     left:  127.0
     right: 60
     stacktrace:
       test/benchee/benchmark/runner_test.exs:197: (test)