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

Standard deviation for time samples #69

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

WhiteBlackGoose
Copy link

@WhiteBlackGoose WhiteBlackGoose commented Dec 24, 2024

Hey, just started using your library today and I really like it. A lot better than the built-in thing.

One (imo vital) statistic that I found missing is the standard deviation, so started working on that one. It's not finished yet, but feel free to correct me on the way so I wouldn't waste time on something you don't want in the lib.

Alternatively to standard deviation we could do sample variance (in my opinion it's less readable, but I found it in the roadmap of this library).

Timer precision: 22 ns
bench1        fastest       │ slowest       │ median        │ mean          │ std dev │ samples │ iters
╰─ fibonacci                │               │               │               │         │         │
   ├─ 1       0.549 ns      │ 1.384 ns      │ 0.614 ns      │ 0.644 ns      │ 0.655 ns │ 100     │ 409600
   ├─ 2       1.593 ns      │ 1.937 ns      │ 1.66 ns       │ 1.691 ns      │ 1.693 ns │ 100     │ 204800
   ├─ 4       4.69 ns       │ 4.715 ns      │ 4.703 ns      │ 4.703 ns      │ 4.694 ns │ 100     │ 51200
   ├─ 8       55.58 ns      │ 113.8 ns      │ 59.21 ns      │ 58.74 ns      │ 58.11 ns │ 100     │ 6400
   ├─ 16      2.948 µs      │ 3.415 µs      │ 3.155 µs      │ 3.099 µs      │ 102.1 ns │ 100     │ 100
   ╰─ 32      4.015 ms      │ 6.609 ms      │ 4.448 ms      │ 4.627 ms      │ 535.4 µs │ 100     │ 100

@WhiteBlackGoose WhiteBlackGoose marked this pull request as ready for review December 24, 2024 23:04
@WhiteBlackGoose
Copy link
Author

I guess it should work now maybe

@WhiteBlackGoose
Copy link
Author

Maybe we should also cut off percentiles. Outliers skew the data too much, realistically we should perhaps keep the 1-99 percentiles, or even 5-95. But that's rather a future consideration?

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