[Development] Short QDateTime optimisation

Jake Petroules Jake.Petroules at qt.io
Mon May 2 10:26:26 CEST 2016


On May 1, 2016, at 7:35 PM, Thiago Macieira <thiago.macieira at intel.com<mailto:thiago.macieira at intel.com>> wrote:

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.

Too bad, I thought I could have helped you here but the MIPS board I just bought is LE. :(

You could always try Debian mips or ppc in qemu. They have prebuilt images.

--
Thiago Macieira - thiago.macieira (AT) intel.com<http://intel.com>
 Software Architect - Intel Open Source Technology Center

_______________________________________________
Development mailing list
Development at qt-project.org<mailto:Development at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/development

--
Jake Petroules - jake.petroules at theqtcompany.com<mailto:jake.petroules at theqtcompany.com>
Consulting Services Engineer - The Qt Company
Qbs build system evangelist - qbs.io<http://qbs.io>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160502/14abe562/attachment.html>


More information about the Development mailing list