[Development] RFC: Proposal for a semi-radical change in Qt APIs taking strings

Marc Mutz marc.mutz at kdab.com
Sat Oct 17 08:06:33 CEST 2015


On Saturday 17 October 2015 01:52:27 Kurt Pattyn wrote:
> > Bottomline: I don't need a fancy anylysis to tell me that less
> > allocations =  faster programs = more happy Qt users.
> 
> But to what extent? If I run my application on a workstation, the effect is
> negligible, as my application has more to do than handling strings. If I
> have an embedded application, every piece of performance gain could
> benefit, but my experience tells me (for MY use cases) that the graphics
> stack is more a bottleneck than string handling.

I object to the notion that a desktop would not benefit from more efficient 
string handling. Hardware doesn't get faster the way it used to. If the speed 
of C++ wasn't needed, your workstation would only run Java apps (and Sun 
tried, but failed).

> >
> > And please don't forget that QString fanboys can continue to massacre the
> > heap  if they so wish. After all, we've had QStringRef for a long time
> > now, but most people still write str.mid(n).toInt() instead of
> > str.midRef().toInt(). QStringView won't change that: A function taking
> > QStringView accepts a QString, too (either by implicit conversion, or
> > where it makes sence, by QString overload).
> 
> The word 'fanboys' disturbs me (I know you don't mean it that way) because
> there are no 'hard' numbers on how 'bad' the current situation really is.
> It would really be helpful to have an idea how 'real-world' applications
> suffer from the current implementation of QString. That would give a very
> good context to decide how Qt can help to leverage these problems.

If you want real-world numbers, follow the optimisations Milian did in moc. 
IIRC, he documented the speedup.They are not (all) string-related, but I also 
don't claim that QStringView will single-handedly make your apps go faster. I 
wrote about QList already. There's more where these topics came from, but 
essentially they all boil down to: "minimise allocations".

> That said, I like the idea of QStringView.

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list