[Development] Cut 7+ms of Qt5 startup time on Linux

Jiergir Ogoerg f35f22fan at gmail.com
Thu Oct 31 16:52:28 CET 2013


Great, of course you're a much better/smarter programmer than me,
but how much time of the whole parsing and loading
(which is done line by line which is slow) does fromUtf8()
take? If it's only like 10-20% then even if it's optimized to work 10 times
faster in the end it's a much smaller improvement compared to
binary loading which almost doesn't do any parsing at all, just copying
from disk onto ready memory.
If the total parsing time after your optimizations
is still like 2x+ times slower than loading the binary cache then imo
your optimizations should be incorporated anyway for the
(rare) cases when there's no (binary) cache yet or when it must be updated.

The type of code (in a loop) I mentioned which features lots of other
decoding/operations
besides fromUtf8():

char l[1024];
        // formating of compose.dir has some inconsistencies
        while (!mappings.atEnd()) {
            int read = mappings.readLine(l, sizeof(l));
            if (read <= 0)
                break;

            char *line = l;
            if (*line >= 'a' && *line <= 'z') {
                // file name
                while (*line && *line != ':' && *line != ' ' && *line !=
'\t')
                    ++line;
                if (!*line)
                    continue;
                const char * const composeFileNameEnd = line;
                *line = '\0';
                ++line;

                // locale name
                while (*line && (*line == ' ' || *line == '\t'))
                    ++line;
                const char * const lc = line;
                while (*line && *line != ' ' && *line != '\t' && *line !=
'\n')
                    ++line;
                *line = '\0';

                if (localeNameLength == (line - lc) && !strncasecmp(lc,
localeData, line - lc)) {
                    file = QString::fromUtf8(l, composeFileNameEnd - l);
                    break;
                }
            }
        }
        mappings.close();


I wonder if we could test your optimizations soon?
Is there a list of other startup optimizations you're working on
so that we don't dilute the efforts by working on the same thing?




On Thu, Oct 31, 2013 at 5:22 PM, Thiago Macieira
<thiago.macieira at intel.com>wrote:

> On quinta-feira, 31 de outubro de 2013 07:38:00, Knoll Lars wrote:
> > Before going to a binary format, I’d first like to check whether we can
> > further speed up the parsing. I’ve done some work in that area in spring,
> > but I know there was still quite some room to improve it.
>
> I'm also improving the fromUtf8 code. My current benchmarks are showing an
> improvement of 2x in the new plain code and 12x with SIMD improvements, for
> mostly ASCII input.
>
> One further step is to detect an UTF-8 locale and use our optimised code,
> instead of letting ICU do the encoding.
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131031/3b6d2187/attachment.html>


More information about the Development mailing list