Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative statistics #280

Merged
merged 8 commits into from
Mar 22, 2019
Merged

Relative statistics #280

merged 8 commits into from
Mar 22, 2019

Conversation

PragTob
Copy link
Member

@PragTob PragTob commented Mar 16, 2019

This is done for 2 reasons:

  1. support a new feature I really want to have before 1.0/as a
    little migration bait which is supposed to show the absolute
    difference to the reference scenario/fastest scenario. This
    is good to put performance gains into perspective. It's
    great if something is 100 times as fast, but if it only
    gains me 1 ms in a program that takes 100ms then it's probably
    not worth it
  2. centralize the calculation of the multiplicator / lesser / more
    thing so that not every formatter has to implement that
    popular calculation by themselves. This also revealed an
    interesting case that I think we're not handling correctly in
    the formatters yet that happens when the average is 0.

It took more code than I thought it'd but looking at it I also
wouldn't know where to cut it.

Input welcome specifically on the struct field names, half-way
unsure there. I didn't document them yet as the other PR isn't
merged yet.

edit: now also includes output which you can see in a comment below

@@ -37,6 +40,9 @@ defmodule Benchee.Statistics do
mode: mode,
minimum: number,
maximum: number,
relative_more: float | nil | :infinity,
relative_less: float | nil | :infinity,
absolute_difference: float | nil,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feedback on field names highly welcome :)

@PragTob
Copy link
Member Author

PragTob commented Mar 19, 2019

This is what it looks like now with absolute difference, I think it's cool but there might be room to improve:

tobi@speedy:~/github/benchee(relative-statistics)$ mix run samples/run.exs 
Operating System: Linux
CPU Information: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Number of Available Cores: 8
Available memory: 15.61 GB
Elixir 1.8.1
Erlang 21.2.7

Benchmark suite executing with the following configuration:
warmup: 2 s
time: 10 s
memory time: 2 s
parallel: 1
inputs: none specified
Estimated total run time: 28 s


Benchmarking flat_map...
Benchmarking map.flatten...

Name                  ips        average  deviation         median         99th %
flat_map           2.41 K      415.33 μs    ±11.27%      406.19 μs      721.41 μs
map.flatten        1.18 K      845.88 μs    ±20.96%      772.94 μs     1350.65 μs

Comparison: 
flat_map           2.41 K
map.flatten        1.18 K - 2.04x slower - +430.55 μs

Memory usage statistics:

Name           Memory usage
flat_map          624.97 KB
map.flatten       781.25 KB - 1.25x memory usage - +156.28 KB

**All measurements for memory usage were the same**

@PragTob PragTob force-pushed the relative-statistics branch 2 times, most recently from d92ecb4 to 0097083 Compare March 19, 2019 12:08
@PragTob
Copy link
Member Author

PragTob commented Mar 19, 2019

compiler was right about a couple of unused variable warnings :)

@PragTob
Copy link
Member Author

PragTob commented Mar 19, 2019

CI is failing for windows... it rather seems like something is wrong with windows/fast function repetition or something as we seem to get the same measurements for map.flatten and flat_map and hence a failing ci on the absolute changes:

execution-warning\n\nYou may disable this warning by passing print: [fast_warning: false] as configuration options.\n\n\nName                  ips        average  deviation         median         99th %\nflat_map         610.35 K        1.64 μs     ±0.00%        1.64 μs        1.64 μs\nmap.flatten      610.35 K        1.64 μs     ±0.00%        1.64 μs        1.64 μs\n\nComparison: \nflat_map         610.35 K\nmap.flatten      610.35 K - 1.00x slower - +0 μs\n"

I don't have a windows install anymore. Yeha on setting up a VM and trying to reproduce. Sad. 😢

@PragTob
Copy link
Member Author

PragTob commented Mar 19, 2019

It sometimes fails on my VM... this is progress.

@PragTob
Copy link
Member Author

PragTob commented Mar 19, 2019

Ok so now this actually gets rid off a significant Windows bug. Fingers crossed for passing build 🤞

@PragTob PragTob force-pushed the relative-statistics branch from 43d8b7d to 488a608 Compare March 19, 2019 15:37
@PragTob
Copy link
Member Author

PragTob commented Mar 19, 2019

☝️ the build actually passed but I guess the owner change has caused it some problems 🤷‍♂️

PragTob added 5 commits March 22, 2019 09:32
This is done for 2 reasons:
1. support a new feature I really want to have before 1.0/as a
  little migration bait which is supposed to show the absolute
  difference to the reference scenario/fastest scenario. This
  is good to put performance gains into perspective. It's
  great if something is 100 times as fast, but if it only
  gains me 1 ms in a program that takes 100ms then it's probably
  not worth it
2. centralize the calculation of the multiplicator / lesser / more
  thing so that not every formatter has to implement that
  popular calculation by themselves. This also revealed an
  interesting case that I think we're not handling correctly in
  the formatters yet that happens when the average is 0.

It took more code than I thought it'd but looking at it I also
wouldn't know where to cut it.

Input welcome specifically on the struct field names, half-way
unsure there. I didn't document them yet as the other PR isn't
merged yet.

Other features (squashed because repeatedly resolving conflicts
is tiring):
* test running without any jobs does not blow up
* new fast sample for quicker whole stack dev feedback
* incorporate relative_more instead of impromptu calculations
* Take care of incomparable values
Added new scenarios to the memory measuyrement brekaer test
because now having to with 0 memory consumption is actually
wanted.
We didn't scale our measured native time for determine_n to
nanoseconds until now 😱
Impact is little, as to the best of my knowledge it only affects
Windows systems and then only significantly with few runs... still
this shouldn't have happend.
(partly to trigger build again so appveyor hopefully doesn't look
stuck anymore)
@PragTob PragTob force-pushed the relative-statistics branch from 3ea3e34 to 200dc8c Compare March 22, 2019 08:34
@PragTob
Copy link
Member Author

PragTob commented Mar 22, 2019

There is... no CI running? Have I accidentally broken everything?

@PragTob PragTob force-pushed the relative-statistics branch from 04ff897 to 0a8900f Compare March 22, 2019 09:40
@PragTob PragTob merged commit 8bcab22 into master Mar 22, 2019
@PragTob PragTob deleted the relative-statistics branch March 22, 2019 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant