Optimise the deletion of a QSharedPointer with no custom deleter
authorThiago Macieira <thiago.macieira@intel.com>
Wed, 23 May 2012 18:26:58 +0000 (20:26 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 10 Oct 2012 06:45:22 +0000 (08:45 +0200)
commit267b1a791d9527fed34c44c53440298331224542
tree93e7070bde7ea65dbdedafcb6e3c1074cfe89871
parent1c8739eda12b79943fd587e9e724f734938244c7
Optimise the deletion of a QSharedPointer with no custom deleter

When QSharedPointer is created with no user-specified custom deleter,
instead of storing a pointer in ExternalRefCount::destroyer to a
static function which, in turn, calls normalDeleter<T> indirectly (via
another function pointer), specialise the CustomDeleter class and make
it not store the pointer, but instead do the deleting directly.

The benefits are:
 - the QSharedPointer's private data is smaller
 - there is no double-indirection via indirect jumps to the actual
 deleter

Change-Id: Ice5653c144912efb1226e432267a047b9799aaca
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
src/corelib/tools/qsharedpointer.cpp
src/corelib/tools/qsharedpointer_impl.h