[Development] QtCS2019 Notes: Clang-based cpp parser for lupdate

Olivier Goffart olivier at woboq.com
Sun Nov 24 18:25:37 CET 2019

On 24.11.19 12:24, Giuseppe D'Angelo via Development wrote:
> Il 21/11/19 17:38, Joerg Bornemann ha scritto:
>> It works and produces seemingly the correct output, able to consume
>> modern C++ constructs.
>> But it's sloooooow. Running on Qt Creator takes 1 min with the old
>> parser, and 50 min with the new one.
> Related question: does also a clang-based moc suffer from this extreme slowness?

Yes. (Although not as bad as that because there is still room for improvement 
in lupdate, also lupdate needs to parse function bodies and moc does not)

I've tried it on my machine, extracting the moc command line from a build of 
one project i'm working on, from a random moc file:

moc from Qt 5.13.2
0.16s user 0.05s system 99% cpu 0.212 total

moc-ng from https://github.com/woboq/moc-ng
1.48s user 0.06s system 98% cpu 1.575 total

This is not using pre-compiled header, so there might be some room for 
improvements. (but even then i wouldn't assume we can use precompiled header 
for all builds)

Note for comparison, the build of the .cpp file that include the .moc with gcc9
3.84s user 0.24s system 99% cpu 4.098 total

So moc stays much faster than actually compiling, but it has been reported that 
moc does not play nice with ccache or distributed compile farm.


More information about the Development mailing list