Folly string is doing CoW only for sizes bigger than 255 and I believe Facebook has measured it because for them it is money. ;-) I am not sure if they use atomics. Maybe you could benchmark them too.
On January 24, 2016 03:21:31 Marc Mutz <marc.m...@kdab.com> wrote: > On Sunday 24 January 2016 03:01:57 Kevin Kofler wrote: >> Marc Mutz wrote: >> > On Friday 22 January 2016 20:46:54 Marc Mutz wrote: >> >> Which one is faster? On a dual-core, probably QVector. On a 64-core >> >> processor, probably std::vector. >> > >> > Running attached test program (4 cores + 2-fold HT), I get these numbers: >> >> That's already 8 virtual cores. He wrote "on a dual-core". :-) > > Not that I didn't post the code, so you could run the benchmark on your > machine, or with numThreads hard-coded to 2... > > QVector: > > 1: 111 > 2: 100 > 4: 111 > 8: 115 > 16: 139 > 32: 179 > 64: 204 > 128: 337 > 256: 644 > 512: 1287 > 1024: 2611 > 2048: 5020 > 4096: 10113 > > std::vector: > > 1: 63 > 2: 63 > 4: 65 > 8: 69 > 16: 119 > 32: 198 > 64: 264 > 128: 375 > 256: 735 > 512: 1385 > 1024: 2719 > 2048: 5545 > 4096: 10444 > > (numThread == 2, same box) > > Copying is still not significantly slower than ref-counting, even for 4K > elements. > > And yes, this suprises even me, but since it perfectly matches my > expecations, > at least qualitatively, I won't spend more time trying to understand this. > The > code is there, I took great care to make it fair, now the CoW fanboys can > explain this (or find a bug in the benchmark). > > At least it seems as if the allocator has a very fast path for > alloc/dealloc/alloc/dealloc/etc chains of a same-sized memory block. > > Thanks, > Marc > > -- > Marc Mutz <marc.m...@kdab.com> | Senior Software Engineer > KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company > Tel: +49-30-521325470 > KDAB - The Qt Experts > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development -- Sent from cellphone, sorry for the typos _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development