diff options
author | hjk <hjk121@nokiamail.com> | 2013-04-22 08:35:23 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-23 18:57:45 +0200 |
commit | 01cbd7e4b5ef841c9e091f54cb7ffa6bb059ac31 (patch) | |
tree | 9b5325804c35a85aebf9cd687249381c09887e16 /src/corelib/tools/qlocale_p.h | |
parent | adec3f4eaf06cf0f0960c481d6cbf9634ee35d66 (diff) |
Remove QLocalePrivate::m_localeID
It was only used for toUpper/toLower but always computed in the
constructor, including QString::toLatin1 conversion and allocations.
This needlessly slows down all other uses, including supposedly "cheap"
operations QString::toDouble, or accesses inside QResourceFileEngine.
The benchmarks indicates that doing it always when needed is bearable.
There's still a lot of improvement potential on these code paths.
Change-Id: I88b637ee11f9f7ea614f8da4ec5df0bf40664fce
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/corelib/tools/qlocale_p.h')
-rw-r--r-- | src/corelib/tools/qlocale_p.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 4c0432bba7..9674342307 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -151,7 +151,7 @@ struct QLocaleId QLocaleId withLikelySubtagsAdded() const; QLocaleId withLikelySubtagsRemoved() const; - QString bcp47Name() const; + QByteArray name(char separator = '-') const; ushort language_id, script_id, country_id; }; @@ -212,8 +212,6 @@ public: : m_index(index), m_numberOptions(numberOptions) { m_data = dataPointerForIndex(index); - m_localeID = bcp47Name().toLatin1(); - m_localeID.replace('-','_'); } ~QLocalePrivate() @@ -232,7 +230,7 @@ public: quint16 languageId() const { return m_data->m_language_id; } quint16 countryId() const { return m_data->m_country_id; } - QString bcp47Name() const; + QByteArray bcp47Name(char separator = '-') const; // ### QByteArray::fromRawData would be more optimal inline QString languageCode() const { return QLocalePrivate::languageToCode(QLocale::Language(m_data->m_language_id)); } @@ -334,11 +332,9 @@ public: QString dateTimeToString(const QString &format, const QDate *date, const QTime *time, const QLocale *q) const; - friend class QLocale; quint16 m_index; quint16 m_numberOptions; const QLocaleData *m_data; - QByteArray m_localeID; }; inline char QLocalePrivate::digitToCLocale(QChar in) const |