> ________________________________________ > From: Development <development-boun...@qt-project.org> on behalf of Giuseppe > D'Angelo via Development <development@qt-project.org> > Sent: Wednesday, September 2, 2020 9:37 PM > To: Andrei Golubev; development@qt-project.org; Ville Voutilainen > Subject: Re: [Development] Important recent changes in > QList/QString/QByteArray > > On 02/09/2020 21:18, Andrei Golubev wrote: > > Also not sure whether it is an implementation detail or the behavior > > that should always be anticipated. > > People build performance sensitive code assuming the cost of certain > operations -- like, assuming that erasing elements from a vector never > reallocates it; and that the only operation that sheds capacity is > squeeze(), everything else (incl. clear(), incl. resize(0)) keeps the > capacity (*). We should stop backstabbing them...
People sometimes care about memory consumption, too. If user's object contains a vector consisting of exactly one element, he may be surprised that it still consumes a place for one million elements, just because one minute ago he removed 999.999 items. If he is creating hundreds of such objects sequentially, his app may not run at all (however, will perform very well). Jarek _______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development