Tricks to speedup Octave building time?

Maybe of interest for other @gsoc_contributors as well.

@shreyaswikriti and I are trying to speedup the Octave building time on her system and want to use for this purpose.

For her openlibm project, we will be forced to build Octave from the configure step very often and want to save time were possible.

To my experience, an Octave build without ccache takes about 20 minutes, while with ccache about 5 minutes (sorry, I do not have accurate figures available now).

For debugging if ccache is properly used ccache -s can be a good indicator:

cache directory                     /home/siko1056/.ccache
primary config                      /home/siko1056/.ccache/ccache.conf
secondary config      (readonly)    /etc/ccache.conf
stats zero time                     Mon Mar 14 20:12:55 2022
cache hit (direct)                  9073
cache hit (preprocessed)            1715
cache miss                         14499
cache hit rate                     42.66 %
called for link                      709
called for preprocessing            2000
compile failed                       997
preprocessor error                   671
bad compiler arguments              2404
autoconf compile/link               7610
no input file                        387
cleanups performed                     0
files in cache                     34052
cache size                          16.1 GB
max cache size                      20.0 GB

In my case 42 % of compilations are taken from the cache and have not to be actually be performed. For lower values, probably the cache is too small or other blockers might be in place.

Another time saver is using multiple threads make -j4 (Parallel (GNU make)), where the number indicates the number of threads used (should match the number of real processor cores) for the build.

Do you have any other tricks to share? :sunglasses:


A few:

  • For frequent builds and for testing WIP patches, disable documentation (--disable-docs). I do this for hg bisections.

  • Using Clang for frequent builds and g++ only for final builds saves another minute or so for each build. Again useful for bisection.

  • I had a good experience with @gharveymn’s CMake addition which sped up configuration by 3X and build by another minute roughly. Described here: A CMake implementation of the build system - #3 by gharveymn

1 Like

Using lld w/ threads for linking (E.g.: LDFLAGS="-fuse-ld=lld -Wl,–threads=16")

1 Like

I don’t really build Octave that often. As a general advice, I think it is important to keep the build to a bare minimum, i.e. disable those stuff not absolutely essential for building Octave.

For examples, all those GUI, Java, audio stuff, … and so on can probably be safely omitted.

Less code to build → Faster build

After you manage to build Octave, you can always re-build with extra stuff.


If you are having to run the configure step repeatedly, the --config-cache option can be helpful.

1 Like