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

Integrate nonius to provide more advanced benchmarking #1616

Merged
merged 3 commits into from
Jun 7, 2019
Merged

Integrate nonius to provide more advanced benchmarking #1616

merged 3 commits into from
Jun 7, 2019

Conversation

fodinabor
Copy link
Contributor

@fodinabor fodinabor commented Apr 27, 2019

Integrates nonius benchmark library to catch to make benchmarks a good bit more advanced.

This implementation nearly works as a drop-in replacement for the old BENCHMARK macro - just a ; needs to be added - and adds a whole lot of improvements:

  • proper warming-up
  • avoiding the benchmark to be optimized away
  • analysis of the runs (with mean, std deviation, outlier classification)

I guess this is a appropriate fix for #852 and also resolves #1186.

Left tasks/questions:

  • not sure if the functionality of internal/benchmark/catch_constructor.hpp is really needed, or I should remove it?
  • some more reporters should probably be supported. Added reporting to xml reporter. (juint has been supported by nonius, so for example output see there..)
  • need to do approval testing..

To collect feedback about the reported info, here's some output from the Benchmark.tests.cpp:
image

@codecov
Copy link

codecov bot commented Apr 29, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@00cb003). Click here to learn what that means.
The diff coverage is 80%.

@@           Coverage Diff            @@
##             master   #1616   +/-   ##
========================================
  Coverage          ?   83.9%           
========================================
  Files             ?     123           
  Lines             ?    3496           
  Branches          ?       0           
========================================
  Hits              ?    2933           
  Misses            ?     563           
  Partials          ?       0

@codecov
Copy link

codecov bot commented Apr 29, 2019

Codecov Report

Merging #1616 into master will increase coverage by 2.62%.
The diff coverage is 71.43%.

@@            Coverage Diff             @@
##           master    #1616      +/-   ##
==========================================
+ Coverage   81.05%   83.67%   +2.62%     
==========================================
  Files         124      123       -1     
  Lines        3478     3380      -98     
==========================================
+ Hits         2819     2828       +9     
+ Misses        659      552     -107

@fodinabor fodinabor changed the title WIP: Integrate nonius to provide more advanced benchmarking Integrate nonius to provide more advanced benchmarking Apr 29, 2019
fodinabor and others added 3 commits June 6, 2019 19:33
Changes done to Nonius:
* Moved things into "Catch::Benchmark" namespace
* Benchmarks were integrated with `TEST_CASE`/`SECTION`/`GENERATE` macros
* Removed Nonius's parameters for benchmarks, Generators should be used instead
* Added relevant methods to the reporter interface (default-implemented, to avoid
breaking existing 3rd party reporters)
* Async processing is guarded with `_REENTRANT` macro for GCC/Clang, used by default
on MSVC
* Added a macro `CATCH_CONFIG_DISABLE_BENCHMARKING` that removes all traces of
benchmarking from Catch
* Units from <ratio> are no longer redeclared in our own namespace
* The default clock is `steady_clock`, not `high_resolution_clock`,
because, as HH says "high_resolution_clock is useless. If you want
measure the passing of time, use steady_clock. If you want user
friendly time, use system_clock".
* Benchmarking support is opt-in, not opt-out, to avoid the large
(~10%) compile time penalty.
* Benchmarking-related options in CLI are always present, to decrease
the amount of code that is only compiled conditionally and making
the whole shebang more maintainble.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename #define BENCHMARK or allow disabling benchmark feature
2 participants