summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-04-15 10:09:30 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-04-15 11:46:19 (GMT)
commitafb54fe253ded94152575b23539552aa8f4ad384 (patch)
tree458cab0f2fa90634c4bd299cb041d5aeb862634b /configure
parent0d80dbc176afa997af7d897344e5a8bfec0317dc (diff)
downloadQt-afb54fe253ded94152575b23539552aa8f4ad384.zip
Qt-afb54fe253ded94152575b23539552aa8f4ad384.tar.gz
Qt-afb54fe253ded94152575b23539552aa8f4ad384.tar.bz2
Speed up qsTr() by caching the translation context
qsTr() uses QFileInfo::baseName() to determine the translation context from a URL. The problem is that creating a QFileInfo object (and thus a file engine object), as well as processing the URL to determine the base name part, is very expensive. By caching the last translation URL and context, qsTr() becomes 5x faster. Only the most recent URL is cached, because a script's text will be translated all at once (as the script is evaluated), so for scripts with multiple translated strings only the first qsTr() call will cause a cache miss. The performance could be improved even further by getting rid of the QFileInfo dependency altogether; created QTBUG-9939 for that since it's a more risky change. Task-number: QTBUG-6908 Reviewed-by: Olivier Goffart
Diffstat (limited to 'configure')
0 files changed, 0 insertions, 0 deletions