Skip to content

Improve performance of date/time

Robert Krawitz requested to merge fast-datetime into master

Improve performance of date/time operations over QDateTime, in particular comparison, by caching the linear time since epoch. This particularly benefits generation of the date bar when there are large numbers of images; it also significantly improves startup time. For reference, on a sample database of about 386,000 images, startup previously took about 12 seconds on a Xeon E3-1505Mv5 (mobile Skylake, roughly equivalent to Core i7-6800HQ). Regenerating the thumbnail bar took about 20 seconds; it now takes est. 200 ms.

For background on the QDateTime issue, reference https://bugreports.qt.io/browse/QTBUG-41714 and https://bugreports.qt.io/browse/QTBUG-75585. Ideally this would be fixed in Qt to avoid this extra complexity, but the Qt developers have indicated that they do not plan to fix it because it would require additional storage (16 bytes vs. 8 bytes currently). Even if it were to be fixed in Qt, we would want to carry this until deprecation of the last supported version of Qt not containing the fix.

There are additional local fixes to ImageDate, to return a const reference to the start and end date/time rather than copying a fresh date/time. This accounts for about 0.5 second improvement in the startup time and improves performance of updating the date bar perceptibly.

Merge request reports