diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/preprocessor.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index a2a1a958cf..590f17c24f 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -154,6 +154,11 @@ bool Preprocessor::skipBranch() Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocessor::TokenizeMode mode) { Symbols symbols; + // Preallocate some space to speed up the code below. + // The magic divisor value was found by calculating the average ratio between + // input size and the final size of symbols. + // This yielded a value of 16.x when compiling Qt Base. + symbols.reserve(input.size() / 16); const char *begin = input.constData(); const char *data = begin; while (*data) { |