[Development] More on QDateTime / QTimeZone
John Layt
jlayt at kde.org
Sat Sep 14 17:11:50 CEST 2013
On Saturday 14 Sep 2013 03:04:45 John Layt wrote:
> * Rather strangely timeSpec() is 30% slower despite now only returning the
> member directly instead of having to do a switch based on the member, a few
> other calls are equally confusing.
Ah, stupid me, I was including the creation in the timings, remove that and
they're the same or faster. Here's some revised numbers for just the
functions themselves, as before 3650 different dates per iteration:
Action Base Msecs %
create(): 0.299 0.418 40
isNull(): 0.082 0.103 26
isValid(): 0.087 0.152 75
date(): 0.060 0.290 383
time(): 0.060 0.292 387
offsetFromUtc(): 6.929 8.242 19
toMSecsSinceEpoch(): 6.256 8.201 31
toMSecsSinceEpoch1950(): 7.065 3.262 -54
toMSecsSinceEpoch2050(): 8.143 9.983 23
setDate(): 0.449 0.814 81
setTime(): 0.428 0.812 90
setMSecsSinceEpoch(): 6.512 3.971 -39
addDays(): 0.456 0.828 82
addMonths(): 1.598 1.989 24
addYears(): 1.574 1.965 25
addMSecs(): 12.600 9.766 -22
toTimeSpec(): 6.642 8.647 30
toOffsetFromUtc(): 6.983 8.691 24
daysTo(): 0.117 0.603 415
msecsTo(): 12.850 16.660 30
equivalentDiffSpec(): 6.290 8.089 29
lessThanDiffSpec(): 6.288 8.054 28
currentDateTime(): 1.110 0.315 -72
fromMSecsSinceEpoch(): 6.083 2.462 -60
As I said, I'm testing a speed-up for toMSecsSinceEpoch() which makes it
faster than the old version, which feeds through to most of the other slower
functions. I'll also have a look at date() and time() for improvements which
will also improve things like daysTo(), but they will always be slower now.
One other note, these are only after the msecs change, adding in the "missing
hour" fix has a marginal effect except on toValid() which balloons out to
8.576 as it has to check the tz now.
John.
More information about the Development
mailing list