[Development] std::allocate_shared for QSharedPointer

Konstantin Tokarev annulen at yandex.ru
Tue Sep 12 12:00:08 CEST 2017


Don't challenge your allocator, just use intrusive reference counting
(e.g. QSharedData)

12.09.2017, 03:45, "Ed Leaver" <ewleaver at comcast.net>:
> Have any of you experience with jemalloc or TCMalloc?
> http://goog-perftools.sourceforge.net/doc/tcmalloc.html
>
> On 09/10/2017 08:26 AM, Thiago Macieira wrote:
>>  On Saturday, 9 September 2017 17:16:24 -03 Sean Harmer wrote:
>>>  Yes, vtune shows the line
>>>
>>>  static_cast<ExternalRefCountWithContiguousData *>(::operator
>>>  new(sizeof(ExternalRefCountWithContiguousData)));
>>>
>>>  is the bottleneck in this particular test case, qt3d/tests/manual/bigscene-
>>>  cpp. I maybe able to reduce the calls to this by a small constant factor but
>>>  I'm not sure yet, need to do some more digging/experimenting. So using a
>>>  pool seemed like a viable approach to reducing this bottleneck.
>>>
>>>  Granted, this is an extreme stress test (1k QEntities, each with 2 x
>>>  QPropertyAnimations) but it makes a nice one to profile.
>>  Well, if you microbenchmark, then memory allocation is almost always a
>>  bottleneck. I'd be more interested in real-world numbers.
>>
>>  But anyway, I don't see a way to pool the private pointers. You always get a
>>  new one if you add a new pointer to an object.
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

-- 
Regards,
Konstantin



More information about the Development mailing list