[Development] Short QDateTime optimisation

Konstantin Tokarev annulen at yandex.ru
Mon May 2 18:07:24 CEST 2016

02.05.2016, 10:44, "Thiago Macieira" <thiago.macieira at intel.com>:
> Hello
> https://codereview.qt-project.org/157714
> I've just pushed one large commit that changes QDateTime to support a "short
> QDateTime Optimisation". Inspired by the SSO mechanism used in libc++ and
> similar to what we've done to QVersionNumber, I've made QDateTime not allocate
> memory for most uses (local time or UTC, within 2 million years of 1970).
> The optimisation is only for 64-bit systems, since QDateTime simply wasn't
> wide enough to accommodate the data. 32 bits isn't enough for storing seconds
> since 1970, much less milliseconds and the extra information we needed. But on
> 64-bit systems, the pointer is split in two: 8 bits for status flags (including
> the LSB indicating it's a short QDateTime) and 56 bits for the millisecond
> count.
> The commit is quite large. I will spend some time during the next week seeing
> if I can split it up into bite-sized chunks.
> Meanwhile, I'd like to ask for help testing this. Since I've dropped the use
> of QSharedDataPointer, I might have introduced sharing issues. And I'd really
> like someone to run the unit tests on a big-endian system.

Do you mean 64-bit big-endian system, or both 32-bit and 64-bit?

> --
> 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


More information about the Development mailing list