Pre-allocate 8 elements to skip trivial reallocations near the beginning of the vectors life.

This commit is contained in:
Kyle Sanderson 2014-07-29 02:48:13 -07:00
parent be79dee6e0
commit ba0406930d

View File

@ -441,6 +441,7 @@ FeatureStatus SDKHooks::GetFeatureStatus(FeatureType type, const char *name)
static void CopyEntityVector(const ke::Vector<HookList> &source, ke::Vector<IPluginFunction *> &destination, int entity) static void CopyEntityVector(const ke::Vector<HookList> &source, ke::Vector<IPluginFunction *> &destination, int entity)
{ {
destination.ensure(8); /* Skip trivial allocations as AMTL uses length<<1. */
for (size_t iter = 0; iter < source.length(); ++iter) for (size_t iter = 0; iter < source.length(); ++iter)
{ {
if (source[iter].entity != entity) if (source[iter].entity != entity)