-
Notifications
You must be signed in to change notification settings - Fork 10
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
Migrate to std.time.Timer and tweak benchmark boundaries #19
Conversation
after making this print stuff, I realize that this might clutter the console - made me think if we should introduce a |
Yeah right! 👍 good point |
Results on Windows look good to me now. I wrote a small Python script to repeatedly call the benchmark and average the results for me. See below. Windowsstd.time.nanoTimestampThe "normal" Windows clock is obviously not suitable for our purpose. To make this work at all, I had to add an additional bounds-check that the recorded durations aren't all-zero.
std.time.TimerWhile std.time.Timer works, you can still observe Windows' clock granularity of 100 ns in the minimum duration and the percentiles:
LinuxI was happy on Linux before, so I'm not going to repeat that test with the old version. std.time.TImerAlso looking very good:
|
That looks good! 🥇 |
const MAX_N = 10000; // maximum number of executions for the final benchmark run | ||
const MAX_ITERATIONS = 10; // Define a maximum number of iterations | ||
const MIN_DURATION = 1_000_000_000; // minimum benchmark time in nanoseconds (1 second) | ||
const MAX_N = 65536; // maximum number of executions for the final benchmark run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for MAX_N
and MAX_ITERATIONS
to be so specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are powers of 2, no specific reason, sorry for the confusion ;-) The numbers are basically orders of magnitude where I found the benchmarks to run smoothly, and to not show too much variance.
I was thinking if we might give them reasonable defaults but expose as configurable, to find optimal settings for a specific scenario?
jup, let's leave it at that for now, and save more elaborate examples / integration tests for later. |
This will address #17 and #18.