[Interest] Tricks to improve moc performance?

Richard Weickelt richard at weickelt.de
Fri Dec 6 19:02:58 CET 2019


> By the way: does anyone know about an implementation that avoids moc runs in
> a similar way how ccache avoids compile runs ?

You mean concatenating header and source files containing a Q_OBJECT macro
and feeding moc the result? I cannot imagine that this would be a safe
transformation in general. Moc accepts defines and include paths on command
line so I would suppose that it tries very hard to parse the C++ code, to
expand macros and to resolve includes. It might work for limited use-cases
though.

I'd say concatenating the output of moc and compiling that in one go is the
only safe shortcut in this process.

Richard


More information about the Interest mailing list