Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-20 Thread Marc Mutz
On Wednesday 20 January 2016 08:19:04 Thiago Macieira wrote: > On Wednesday 20 January 2016 08:12:58 André Somers wrote: > > Where is this qAsConst coming from? When was it introduced? Where is it > > documented? > > Commit 264c72837d6ff717a248dd180c2dfb45391c6aab, in dev. No api docs. It was

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-20 Thread Smith Martin
.org Subject: Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range On Wednesday 20 January 2016 08:19:04 Thiago Macieira wrote: > On Wednesday 20 January 2016 08:12:58 André Somers wrote: > > Where is this qAsConst coming from? When was it introduced? Where is it >

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-20 Thread Knoll Lars
On 20/01/16 11:58, "Development on behalf of Marc Mutz" wrote: >On Wednesday 20 January 2016 08:19:04 Thiago Macieira wrote: >> On Wednesday 20 January 2016 08:12:58 André Somers wrote: >> > Where is this qAsConst coming from?

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread Gunnar Roth
18. Januar 2016 um 00:28 Uhr Von: "Thiago Macieira" <thiago.macie...@intel.com> An: development@qt-project.org Betreff: Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range On Sunday 17 January 2016 22:22:39 Gunnar Roth wrote: > why is QLatin1String more

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread André Somers
Op 20/01/2016 om 06:47 schreef Thiago Macieira: On Wednesday 20 January 2016 05:20:36 Kevin Kofler wrote: Thiago Macieira wrote: foreach copies; ranged for doesn't. … unless you try to use it on a non-const Qt container with usage count >1, then it will even deep-copy (detach) it! (I know

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread Kevin Kofler
Thiago Macieira wrote: > foreach copies; ranged for doesn't. … unless you try to use it on a non-const Qt container with usage count >1, then it will even deep-copy (detach) it! (I know you know this, but you should warn people about it.) So you need to be very careful about what you pass to

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread Thiago Macieira
On Wednesday 20 January 2016 08:12:58 André Somers wrote: > Where is this qAsConst coming from? When was it introduced? Where is it > documented? Commit 264c72837d6ff717a248dd180c2dfb45391c6aab, in dev. No api docs. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect -

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread Knoll Lars
On 20/01/16 08:12, "Development on behalf of André Somers" wrote: > > >Op 20/01/2016 om 06:47 schreef Thiago Macieira: >> On Wednesday 20 January 2016 05:20:36 Kevin Kofler wrote: >>> Thiago Macieira wrote: foreach

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread Thiago Macieira
On Wednesday 20 January 2016 05:20:36 Kevin Kofler wrote: > Thiago Macieira wrote: > > foreach copies; ranged for doesn't. > > … unless you try to use it on a non-const Qt container with usage count >1, > then it will even deep-copy (detach) it! (I know you know this, but you > should warn people

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread André Somers
Op 20/01/2016 om 08:18 schreef Knoll Lars: Where is this qAsConst coming from? When was it introduced? Where is it documented? I can't find it in my Qt documentation. It just got added some weeks ago, after we realised that range-for would lead to our containers detaching. So it'll be in

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread Thiago Macieira
On Wednesday 20 January 2016 08:37:45 André Somers wrote: > Op 20/01/2016 om 08:18 schreef Knoll Lars: > >> Where is this qAsConst coming from? When was it introduced? Where is it > >> documented? > >> > >> I can't find it in my Qt documentation. > > > > It just got added some weeks ago, after

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-19 Thread Thiago Macieira
On Tuesday 19 January 2016 09:50:37 Gunnar Roth wrote: > Thank you Thiago. > > Actually I meant ucomparing a QString with a QStringLiteral when i said > " both strings being uft16 seems to be faster ". > So what i learned now on an x85 with avx support is should be no performance > problem. We

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-17 Thread Gunnar Roth
Hi, thanks for answering, but > Am 17.01.2016 um 20:36 schrieb Thiago Macieira : > > On Sunday 17 January 2016 19:13:44 Gunnar Roth wrote: >> Hi, >> I saw quite some changes like https://codereview.qt-project.org/#/c/145961/ >>

[Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-17 Thread Gunnar Roth
Hi, I saw quite some changes like https://codereview.qt-project.org/#/c/145961/ Replace QStringLiteral with QLatin1String in QFileSelector. I also read about the problem of QStringLiteral concerning plugins, but what is the idea behind these

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-17 Thread Thiago Macieira
On Sunday 17 January 2016 19:13:44 Gunnar Roth wrote: > Hi, > I saw quite some changes like https://codereview.qt-project.org/#/c/145961/ > Replace QStringLiteral > with QLatin1String in QFileSelector. I also read about the problem of >

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-17 Thread Thiago Macieira
On Sunday 17 January 2016 19:31:54 Olivier Goffart wrote: > As explained here: https://woboq.com/blog/qstringliteral.html > QStringLiteral can avoid malloc and conversion to QString. But there is an > operator==(const QString&,QLatin1String) which also don't do allocations or > conversion. In

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-17 Thread Olivier Goffart
On Sonntag, 17. Januar 2016 19:13:44 CET Gunnar Roth wrote: > Hi, > I saw quite some changes like https://codereview.qt-project.org/#/c/145961/ > Replace QStringLiteral with QLatin1String in QFileSelector. I also read > about the problem of QStringLiteral concerning plugins, but what is the idea >

Re: [Development] QStringLiteral vs QLatin1String , foreach vs for range

2016-01-17 Thread Thiago Macieira
On Sunday 17 January 2016 22:22:39 Gunnar Roth wrote: > why is QLatin1String more efficient than QLiteralString in this case? both > strings being uft16 seems to be faster for, you could use size_t chunks > for comparison for example. Your premise is wrong. The QLatin1String is not stored as