open_spiel icon indicating copy to clipboard operation
open_spiel copied to clipboard

Improve test compilation speed and space usage by linking tests against `libopen_spiel.so`

Open jthemphill opened this issue 8 months ago • 16 comments

This is an alternative approach to #1124. Compared to the status quo, it cuts over 500MB off of the compiled build artifacts, cuts three minutes off the single-threaded full build time, and removes a lot of thinking about which libraries you need to link your game or test against.

Before:

$ make clean ; time make -j8
real    5m25.136s
user    34m56.492s
sys     2m8.369s

$ du -sh games
629M    games

After:

$ ninja clean ; time ninja -j8
[757/757] Linking CXX shared module python/pyspiel.so

real    4m35.704s
user    31m10.678s
sys     1m51.133s

$ du -sh
111M    .

$ du -sh games
34M     games

Previously, we conditionally generated libopen_spiel.so. Now, we always generate it. And when creating a new executable, you'll want to use add_open_spiel_executable() instead of add_executable(...${OPEN_SPIEL_OBJECTS}).

jthemphill avatar Oct 16 '23 08:10 jthemphill