Why not optimize _Destroy for non-standard allocators, too?
KHO,THOMAS WIN
tkho@ucla.edu
Fri Aug 12 22:08:00 GMT 2005
In stl_construct.h in gcc 4.1, _Destroy puts extra effort to check that
the standard allocator is used before optimizing for types that have
trivial destructors.
This behavior is described by the code comment:
* Destroy a range of objects using the supplied allocator. For
* nondefault allocators we do not optimize away invocation of
* destroy() even if _Tp has a trivial destructor.
In a benchmark that uses a custom allocator that reflects a large
application, we found over a 1% improvement after allowing the same
optimization for non-default allocators. For us, this speedup comes from
faster calls to vector::clear().
What's the intention for not optimizing this function for non-default
allocators?
Regards,
Thomas Kho
More information about the Libstdc++
mailing list