From kde-commits Wed Sep 01 06:49:00 2010 From: zander () kde ! org Date: Wed, 01 Sep 2010 06:49:00 +0000 To: kde-commits Subject: Re: koffice/kspread Message-Id: <201009010849.01167.zander () kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=128332378528902 On Tuesday 31. August 2010 22.02.22 Marijn Kruisselbrink wrote: > On Tuesday 31 August 2010 21:13:35 Carlos Licea wrote: > > > SVN commit 1170195 by mkruisselbrink: > > > > > > eliminate a lot of useless qstring creation/deleting, this speeds > > > loading up again quite a bit > > > > > > M +61 -34 Cell.cpp > > > M +29 -15 Sheet.cpp > > > > I wonder if you could save a bit of memory by using QLatin1Strings > > instead of plain QStrings. QString uses UTF16 (IIRC) while all those > > strings can be represented by plain ASCII. > > Yeah, good point; although it of course would be only a rather > insignificant amount of memory saved, but it still would be nicer indeed. We are talking about stuff like; + static const QString sPercentage = QString::fromAscii("percentage"); Using QLatin1String there is equivalent to using const char *. While that saves memory, you should notice that the QLatin1String has no internal storage other than the char pointer. In other words; you will get conversions to UTF-16 on every usage, there is no caching done. I do suggest changing the 'fromAscii' to 'fromLatin1' as they are functionally equivalent for most setups, but fromAscii goes via a plugin and thus is slightly slower and second can change behavior if someone set a different QTextCodec::codecForCStrings -- Thomas Zander