GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING is slow
David Malcolm
dmalcolm@redhat.com
Wed Jan 1 00:00:00 GMT 2014
I've been experimentally porting GNU Octave's JIT to libgccjit, and I've
got to the point where it's generating convincing-looking code for
non-trivial loops.
I got alarmed with how slow the compilation appeared to be: using
GCC_JIT_BOOL_OPTION_DUMP_SUMMARY to emit timing information showed that
the library was taking ~5 seconds to compile a simple loop (along with
about 30 trivial helper functions).
However, some tweaking revealed the cause of the slowdown: I had
GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING enabled for debugging purposes. On
un-setting that flag, it got *much* faster.
Here are some crude timings (in seconds), where "DE" =
GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING and
"OPT_LEVEL" = GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL.
Build DE OPT_LEVEL usr sys wall ggc
------- -- --------- ---- ---- ---- ------
Checked 1 3 3.73 1.09 4.96 5409 kB
Release 1 3 2.65 0.96 3.74 5383 kB
Checked 0 3 1.05 0.11 1.30 5224 kB
Release 0 3 0.29 0.08 0.40 5198 kB
Checked 0 0 0.38 0.05 0.47 3958 kB
Release 0 0 0.14 0.03 0.22 3945 kB
As you can see, for this test, GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING slows
things down, *much* more so than the checked vs release distinction, or
turning on optimizations. The effect is probably more pronounced at
higher optimization levels, in that more optimizations means more passes
to dump.
I don't intend to try to speed up the DUMP_EVERYTHING option - I just
wanted to warn people that it has a major impact on how long the JIT
compile takes.
Dave
More information about the Jit
mailing list