You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What's more is that we don't gain any performance from parallelization. For example, if we split documents into 10 arrays of 5k documents each, and initialize one Firestore.Decoder for each group:
letitems=awaitwithTaskGroup(of:[Item].self){ group in// chunkedDocuments: [[QueryDocumentSnapshot]]
for chunk in chunkedDocuments {
group.addTask{letdecoder=Firestore.Decoder()return chunk.compactMap{try? $0.data(as:Item.self, decoder: decoder)}}}varitems=[Item]()
for awaitresult in group {
items.append(contentsOf: result)}return items
}
...the total time is worse: about 10.3s.
So there are 2 issues:
Why is Firestore.Decoder 4x slower than JSONDecoder?
Does Firestore.Decoder utilize some shared internal state that prevents instances from running independently on different threads?
Reproducing the issue
No response
Firebase SDK Version
10.29
Xcode Version
16
Installation Method
Swift Package Manager
Firebase Product(s)
Firestore
Targeted Platforms
iOS, macOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
The text was updated successfully, but these errors were encountered:
Description
Decoding an array of
QuerySnapshotDocument
usingFirestore.Decoder
is very slow, compared to decoding a similar array usingJSONDecoder
:What's more is that we don't gain any performance from parallelization. For example, if we split
documents
into 10 arrays of 5k documents each, and initialize oneFirestore.Decoder
for each group:...the total time is worse: about 10.3s.
So there are 2 issues:
Firestore.Decoder
4x slower thanJSONDecoder
?Firestore.Decoder
utilize some shared internal state that prevents instances from running independently on different threads?Reproducing the issue
No response
Firebase SDK Version
10.29
Xcode Version
16
Installation Method
Swift Package Manager
Firebase Product(s)
Firestore
Targeted Platforms
iOS, macOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand
Package.resolved
snippetReplace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippetReplace this line with the contents of your Podfile.lock!
The text was updated successfully, but these errors were encountered: