Speed up incremental compilation time of tests #6275
Scony
started this conversation in
Engine Core
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
At the moment, in current
master
(as of 11th February 2023) the incremental compilation of tests takes a very long time. In my case it's ~2 minutes after a tiny change in 1 test case.Example
What I mean by incremental is as follows - suppose I've just built an engine with tests using the command:
now, if I change one line of code in any of the tests which are then included by
tests/test_main.cpp
, and run the above command again I'll get this:which reads as follows:
Looking at the above the issue seems quite obvious - the compilation is the major problem.
Solution
How can one improve the overall incremental build time in that case? There are at least 3 options:
Option 3 is not an option obviously. Option 1 looks quite easy, but in reality, it does not scale with the number of test cases. Option 2, however, is not that complex and it scales perfectly well with the number of test cases i.e. if some translation unit becomes big, it can be split into pieces.
Example again
Suppose we've decided to introduce a new test case but as a separate translation unit - just like in this PR: godotengine/godot#73108. Moreover, suppose we've already built the tests and run them.
Now, if we change one line in the
test_navigation_server_3d.h
and run:we will get:
which reads as:
Conclusions
incremental compilation of smaller translation unit - independent from others - resulted in build time of tests faster by order of magnitude.
This way, writing tests is much more efficient and more encouraging - especially to non-advanced C++ programmers.
Proposal
Granted the above, I propose to split tests into multiple translation units.
Beta Was this translation helpful? Give feedback.
All reactions