This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Why not optimize _Destroy for non-standard allocators, too?
- From: "KHO,THOMAS WIN" <tkho at ucla dot edu>
- To: libstdc++ at gcc dot gnu dot org
- Date: Fri, 12 Aug 2005 15:07:57 -0700
- Subject: Why not optimize _Destroy for non-standard allocators, too?
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