catchorg / catchorg/Catch2

REQUIRE has very large compilation time overhead

Open
#668 0 comments 9 reactions 0 assignees View on GitHub
Tweak request
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

Hi,

After investigating the compilation time of my test cases, I have found that a lot of time was simply used by Catch and especially the REQUIRE macro. There are several reasons for that, but the main reason is that the macros are generating a lot of code and that because of the expression left and right hand sides deduction, it is hard to simplify the macros.

By introducing REQUIRE_EQUALS macros in my code and simplifying it to the maximum, I have been able to reduce the total compilation time of my tests by 27%!

If you are interested, you can have a look at: http://baptiste-wicht.com/posts/2016/06/reduce-compilation-time-by-another-16-with-catch.html for more information.

REQUIRE_EQUALS and CHECK_EQUALS may be something you want to consider for users that care about the compilation time.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.