Though it’s probably rare that one extra allocation has a non-negligible performance impact
In this case, it’s being used for custom serialization of small data types that has to run in a tight loop that is otherwise pretty inexpensive. The allocation cost isn’t huge, but it is non-negligible.
It might be nice to have a keyword argument for this in the Vector constructor:
Vector{SomeType}(sizehint = n) # like sizehint!(Vector{SomeType}(), n)
Vector{SomeType}(undef, m, sizehint = n) # like sizehint!(Vector{SomeType}(undef, m), n)
empty! seems preferable to resize! here, because it’s shorter and easier to remember, and also because it makes the job slightly easier for the compiler/optimizers.