You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compilation of validation.h starts getting slightly slow. Because this file doesn't regularly change, we can reduce the compile time for the validators by using precompiled headers: https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
These precompiled headers can probably be stored in /tmp for each problem. If every problem uses a symlink to a shared validation.h, we might even be able to generate one precompiled header file for all these problems, but will probably be a bit messy.
The text was updated successfully, but these errors were encountered:
I tried this a few days back. On my machine, it reduced the compilation time of a simple input validator (basically only v.read_integer and v.newline) from 1.7–1.9 seconds down to 1.2–1.4 seconds. I don't think this reduction in compile time is large enough to start going through the trouble of implementing this in BAPCtools.
A different idea (thanks to some discussion with more C++-savvy people) could be to rewrite validation.h as a .cpp file, and only include the interfaces of the validators in the header file. We could then try to dynamically link this new validation.cpp to the validators in BAPCtools. DOMjudge doesn't need to know about any of that, since it will just call g++ with all .cpp files combined in one go. But this requires a bit more time to experiment with 😛
Hmm bummer that precompiled headers only make such a small difference. Dynamic linking does sound like a solution that would work but indeed also not very straightforward.
Maybe we could investigate which part of compilation is slow and speed that up somehow. We use templates for integer vs floating point input but instantiating things twice shouldn't be too bad.
Another thing to try could be to just lower the optimization level?
From a discussion with @RagnarGrootKoerkamp on Slack.
The compilation of
validation.h
starts getting slightly slow. Because this file doesn't regularly change, we can reduce the compile time for the validators by using precompiled headers: https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.htmlThese precompiled headers can probably be stored in
/tmp
for each problem. If every problem uses a symlink to a sharedvalidation.h
, we might even be able to generate one precompiled header file for all these problems, but will probably be a bit messy.The text was updated successfully, but these errors were encountered: