[PATCH] KSpell2 improvement
Thiago Macieira
thiago at kde.org
Mon Mar 27 18:10:35 BST 2006
Dirk Mueller wrote:
>On Monday, 27. March 2006 18:34, Thiago Macieira wrote:
>> Second, you construct allLocalizedDictionaries at every call to
>> languagesName. That sounds like a waste. I had recommended to
>> implement it with a static list instead, built on first use.
>
>Huh? Its all global const, there is no need to do a onconstruction hook.
It is global const, but the code calls it every time.
void Dialog::slotChangeLanguage( const QString& lang )
{
- d->checker->changeLanguage( lang );
+ d->checker->changeLanguage(
+ d->checker->broker()->languages()[
+ d->checker->broker()->languagesName().findIndex( lang ) ] );
slotSuggest();
}
Every time slotChangeLanguage is called, the list is recreated, including
the i18n calls.
>> For the KDE4 code, I recommend using Q_GLOBAL_STATIC_WITH_ARGS:
>
>Why? bloating startup even more?
Not at startup. Q_GLOBAL_STATIC has initialise-on-first-use semantics and
is thread-safe.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
thiago.macieira (AT) trolltech.com Trolltech AS
GPG: 0x6EF45358 | Sandakerveien 116,
E067 918B B660 DBD1 105C | NO-0402
966C 33F5 F005 6EF4 5358 | Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060327/788096f4/attachment.sig>
More information about the kde-core-devel
mailing list