diff options
| author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2025-02-22 13:40:11 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-03-11 17:06:22 +0100 |
| commit | b3c75be5e0347078af16d260b197d49ef363729d (patch) | |
| tree | cd0e1be42d4a2c1f4ad63e93774dbc6881b373ae /src/gui/opengl/qopenglprogrambinarycache.cpp | |
| parent | fcde54148dc3ea433bdcaaa550676cd0ab368673 (diff) | |
QTimeZone::utc(): micro-optimize it
QTimeZone::utc() goes through the QTimeZone(int) constructor,
passing 0 to it. That in turn calls the QUtcTimeZonePrivate(int)
constructor, which ends up matching the zero offset and doing some
string comparisons.
I think we can bypass this mechanism and simply have QTimeZone::utc()
create a QUtcTimeZonePrivate and set it.
Compare the following results for tst_QTimeZone::utc benchmark as
built on a machine with:
Config: Using QtTest library 6.10.0, Qt 6.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 14.2.1 20250207), arch unknown
Before:
36.708812 nsecs per iteration (total: 36,708,776, iterations: 999999)
169.024518 CPU cycles per iteration, 4,6 GHz (total: 169,024,349, iterations: 999999)
601.286607 instructions per iteration, 3,557 instr/cycle (total: 601,286,006, iterations: 999999)
139.051610 branch instructions per iteration, 3,79 G/sec (total: 139,051,471, iterations: 999999)
After:
29.204813 nsecs per iteration (total: 29,204,784, iterations: 999999)
129.981345 CPU cycles per iteration, 4,45 GHz (total: 129,981,216, iterations: 999999)
408.260941 instructions per iteration, 3,141 instr/cycle (total: 408,260,533, iterations: 999999)
85.047524 branch instructions per iteration, 2,91 G/sec (total: 85,047,439, iterations: 999999)
Relative Delta:
before after improvement
nsecs 36.7 29.2 1.26x
cycles 169.0 130.0 1.30x
instr. 601.3 408.0 1.47x
branch 139.1 85.0 1.63x
Change-Id: Ic6fe605a3c6a83096315e2cb4309b9f67e83bccc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/opengl/qopenglprogrambinarycache.cpp')
0 files changed, 0 insertions, 0 deletions
