Optimize memory allocation for array in PklDecoder.decodePolymorphic (#25)

This commit is contained in:
XIAO YU 2024-08-13 20:53:04 +09:00 committed by GitHub
parent 48bdb4f503
commit 8f050f5938
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -205,6 +205,7 @@ extension _PklDecoder {
))
}
var arr: [AnyHashable?] = []
arr.reserveCapacity(pklArray.count)
for v in pklArray {
try arr.append(self.decodePolymorphic(v, codingPath: codingPath)?.value)
}