-
Notifications
You must be signed in to change notification settings - Fork 22
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
fable: Fix excessive compilation duration #206
Conversation
fe5deca
to
d563066
Compare
Looks great, thanks for the work! |
I'd merge this to master, to make it part of 0.21, and if requested, we can also backport this to 0.20 and 0.19. What do you think? |
Thank you! A backport is not needed since the users have the same as a workaround and want to upgrade to develop soon. |
d563066
to
da6d42b
Compare
Force-push: Removed formatting of code in order to better apply to |
da6d42b
to
6ff5af8
Compare
07b1c22
to
f0ee64d
Compare
Update: I've been attempting to get a positive result in before-after testing. So far I've been unsuccessful. I've added a stress test that should be representative of problematic use-cases. I've been able to reproduce long compile times up to over an hour for a single file. However, the patch @clsim Could you have a look at this and see if I've missed something or made a mistake somewhere? |
Here are the steps that can be used to compile and run the stress test: git clone https://github.com/eclipse/cloe
cd cloe
git switch clsim/bugfix-make-schema
make -f Makefile.docker build-ubuntu-20.04 run-ubuntu-20.04
cd fable/examples/stress
make all
# -> This probably fails because cmake is too old on ubuntu:20.04 image,
# but Conan tells us how to call cmake.
cd build/Release
cmake ../.. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/cloe/fable/examples/stress/build/Release/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release
time make all With the default settings, this last command |
I let the compilation run over night, this is the output of -ftime-report and the 'time' program: real 891m14,703s |
BREAKING CHANGES: - Removed all make_schema() functions that do not fall into one of the two signatures: make_schema(T*, std::string&&) make_schema(T*, P&&, std::string&&) So far, only the two forms above have been used, and the others aren't strictly required and don't contribute to readability.
7753ea5
to
aa8828d
Compare
This is the optimal form, according to an analysis by Nicolai Josuttis in a CppCon18 talk: Nicolai Josuttis “The Nightmare of Initialization in C++” https://www.youtube.com/watch?v=7DTlWPgX6zs
After some more work with @hvolx we managed to discover the issue and fix it. Essentially, perfect forwarding the |
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.
Looks good for me
Users of fable experienced compilation durations up to 12h. This PR is delivering a proven-in-use mitigation.