Revert "[vector] Optimize grow_vector() for size"

This reverts commit 1dd9396c7a.

Is faster indeed.

15% on SourceHanSans/10000 benchmark.
This commit is contained in:
Behdad Esfahbod 2022-12-01 19:40:21 -07:00
parent 2644540a74
commit 8e9e94dba9
1 changed files with 10 additions and 0 deletions

View File

@ -254,6 +254,16 @@ struct hb_vector_t
return new_array;
}
template <typename T = Type,
hb_enable_if (hb_is_trivially_constructible(T))>
void
grow_vector (unsigned size)
{
memset (arrayZ + length, 0, (size - length) * sizeof (*arrayZ));
length = size;
}
template <typename T = Type,
hb_enable_if (!hb_is_trivially_constructible(T))>
void
grow_vector (unsigned size)
{