Optimize allocation of sequences from toPreserve

This commit is contained in:
Emery Hemingway 2021-09-08 18:01:12 +02:00
parent fc53b47ec6
commit efd5cf62df
1 changed files with 1 additions and 1 deletions

View File

@ -536,7 +536,7 @@ proc toPreserve*[T](x: T): Preserve =
elif T is seq[byte]:
result = Preserve(kind: pkByteString, bytes: x)
elif T is array | seq:
result = Preserve(kind: pkSequence)
result = Preserve(kind: pkSequence, sequence: newSeqOfCap[Preserve](x.len))
for v in x.items: result.sequence.add(toPreserve(v))
elif T is bool:
result = Preserve(kind: pkBoolean, bool: x)