[Development] Question about QCoreApplicationData::*_libpaths
Milian Wolff
milian.wolff at kdab.com
Tue Jan 19 11:15:43 CET 2016
On Dienstag, 19. Januar 2016 11:51:42 CET Marc Mutz wrote:
> I missed one:
>
> On Monday 18 January 2016 23:43:37 Marc Mutz wrote:
> > #include <QVector>
> > #include <string>
> >
> > int main() {
> >
> > QVector<QByteArray> l;
> > int oldC = l.capacity();
> > for (int i = 0; i < 10000000; ++i) {
> >
> > char buf[std::numeric_limits<int>::digits + 1];
> > sprintf(buf, "%d", i);
> > l.push_back(buf);
> > int newC = l.capacity();
> > if (newC != oldC)
> >
> > qDebug("%d", newC);
> >
> > oldC = newC;
> >
> > }
> >
> > }
> >
> > $ time ./test
> > <snip>
> > real 0m1.769s
> > user 0m1.572s
> > sys 0m0.192s
>
> Same with std::vector<QByteArray>:
>
> real 0m1.776s
> user 0m1.616s
> sys 0m0.156s
>
> > best of three runs, core i7-2720QM, GCC 5.3
>
> Ditto.
>
> So... is realloc actually the optimisation everyone (incl. me) expected it
> to be?
Did you run it through a profiler? Where is the time actually spent?
--
Milian Wolff | milian.wolff at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5903 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160119/3ec24063/attachment.bin>
More information about the Development
mailing list