-
-
Notifications
You must be signed in to change notification settings - Fork 742
Added benchmark framework and improvements to toTextRange #85
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
Conversation
Very useful, but where should this stuff go? |
I think this should be in |
Another idea, perhaps there should be an option to output results in a machine readable format so charts etc can be generated - CSV is probably the simplest to support here. |
Nitpicks: 31043: Both examples won't work: 31105: Should we also place a check - if benchmark_xxx is callable? And name - benchmark2 is odd, I somehow expected that it works only with 2 functions or some such. If it's user accessible artifact we need a better name. Overall seems cool, and using a nop loop as a baseline is a great idea. |
I agree that benchmark doesn't belong in std.datetime. At least in Google's libs, benchmarking comes packaged with unittesting, but we don't have a unittest package :o). If deemed appropriate, we could add a new module std.benchmark. |
BTW, to benchmark Phobos on Linux you'd say: make BENCHMARK=1 BUILD=release unittest To benchmark one module only: make BENCHMARK=1 BUILD=release generated/linux/release/32/unittest/std/some_module Currently there are only three benchmarks, but the way I see things going forward is that all of Phobos' important entities will have benchmarks that will be improved on a need basis and scrutinized with each release. |
@mrmonday: I have access to total time, but that is confusing and irrelevant given that it's influenced by the total number of iterations. The columns contain numbers that can be directly compared across functions. |
I definitely support the idea of moving the benchmarking code out of std.datetime. It's related but still pretty separate, and std.datetime is large enough that if there's an obvious case where something might be better off in a separate module, then it should probably be put in a separate module. Creating a std.benchmark for the benchmarking functions makes good sense, and I'd even suggest moving |
OK, this became reviewable. Have at it -- thanks! |
import core.exception; | ||
|
||
//============================================================================== | ||
// Section with StopWatch and Benchmark Code. |
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.
Is that header still needed?
I notice that your changes yank out from std.datetime |
Is there a good reason why instead of having a struct or class with the benchmarking functions on it and which then has |
I will add the import. Regarding benchmarkPause/benchmarkResume, it's just KISS at work. There's only one benchmark running at most, so adding the struct/class scaffolding to give the illusion there may be multiple instances out there, to then do even more work to prevent those multiple instances from being created - there's no advantage to doing so. |
Integrated feedback (thanks!) |
All -- please let me know if this should instead follow the standard review process. If so, we're looking for a review manager. Thanks! |
StopWatch sw; | ||
enum n = 100; | ||
TickDuration[n] times; | ||
TickDuration last = TickDuration.from!"seconds"(0); |
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.
You left bar undefined, add this here:
static void bar() {}
You also didn't update the windows makefile. I guess you use the Linux makefile via Wine? I've updated it but I'm not sure how I can "glue" my changeset to your pull request. (it's not in my repo yet). |
Is there any reason to keep this pull request open at this point? It was decided that we should review it in the newsgroup, and you (Andrei) said that you were reworking it. I'd argue that it would be better to just close this one for now, and then you can create a new one when we're actually ready to merge it in. |
use ddox release version instead of master
This is a pretty cool benchmark framework that makes it easy to collect good-quality data about function run times. As a proof of concept I integrated the framework with Phobos itself. Have at it!