benchee icon indicating copy to clipboard operation
benchee copied to clipboard

Add configuration options to override Benchee default values

Open PragTob opened this issue 8 years ago • 8 comments

Benchee is getting a lot of configuration options - which is great. But the more configurations options and formatters there are, the more people would probably prefer to configure some of them globally for their project.

Something like:

config :benchee, :options, %{} # fancy map or keyword list overriding default options

These options should then represent the new default options. So merge order would be something like: default_config <- app_config <- benchmark_config (<- meaning right overrides left)

PragTob avatar Oct 12 '16 08:10 PragTob

Default config can be found here: https://github.com/PragTob/benchee/blob/master/lib/benchee/config.ex#L156

Example for mix config: https://hexdocs.pm/mix/Mix.Config.html

h4cc avatar Feb 26 '17 18:02 h4cc

Is it ok for config to be included at compile time?

  @default_config %{
    parallel:   Application.fetch_env!(:benchee, :parallel, 1),
  }

h4cc avatar Feb 28 '17 19:02 h4cc

Working on this.

h4cc avatar Feb 28 '17 19:02 h4cc

So, in light of the recent configuration guidelines, should we still do this? I think we can totally get away without application config.

devonestes avatar Jun 28 '18 10:06 devonestes

It's something that I still don't fully understand.

I still think saying that I always want to use the HTML formatter might be useful and I dunno how else to best do it otherwise.

On the other hand, if people want that they could write their own little wrapper.

PragTob avatar Jul 15 '18 12:07 PragTob

We could do what Credo does and have a .benchee.exs file that's read as default configuration at runtime. That way we're not dealing with compile time configuration (which I believe is what those configuration guidelines are helping to prevent).

devonestes avatar Jul 16 '18 02:07 devonestes

Good point :clap:

Although until we have a way to specify paths without mentioning the file name this isn't essential to me. So I'll also remove the 1.0 milestone

PragTob avatar Jul 16 '18 09:07 PragTob

Thought about this one again: https://elixirforum.com/t/feedback-app-config-for-libraries-anti-pattern/60540/4?u=pragtob

PragTob avatar Dec 23 '23 09:12 PragTob