Optimize allocation of sequences from toPreserve
This commit is contained in:
parent
fc53b47ec6
commit
efd5cf62df
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue