Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.5.0
-
None
Description
I noticed that QStringList::join() always allocates a new string except for trivial case when the list is empty.
There is however another very frequent special case which I think deserves special care and optimization - the case when the list contains only one string. In that case we can return this string and avoid allocation altogether, only increase the string refcount, which is much faster than allocation.
And a side note: I also noticed that there are two overloads of QtPrivate::QStringList_join(). I understand the need for the two overloads but I do not know why each of them has completely different implementation, one using loop with index and the other one using iterators. I believe this should be unified, choose one of them, whichever is faster.