Description
Operating System
ubuntu
Environment (if applicable)
Version 131.0.6778.85 (Official Build) (64-bit)
Firebase SDK Version
10.11.1
Firebase SDK Product(s)
Firestore
Project Tooling
Flutter
Detailed Problem Description
I have a minimal reproduction sample (as much as I could) where a simple query hitting the cache takes a whopping 45 seconds to resolve.
During my trials to reproduce this issue I've found that:
- The same query, when
disableNetwork()
is called before writing the data to Firestore takes an order of magnitude less time to resolve. After glancing over index_db, I see that the way data is stored is not the same when network is disabled, which could explain the effect on performances. - The same query also resolve normally when there is no flutter animation on the screen.
As I could not isolate the issue to any of those technologies (flutter & firestore), this leads me to believe there are performances issues in both firestore and flutter animation mechanism acting on each other. Furthermore the fact that the query is resolving in normally depending on how it has been written is indicative that there is an issue on the firestore side there.
Steps and code to reproduce issue
Prerequisite: Flutter is required to launch this
- Clone
https://github.com/cedvdb/flutter_animation_perf
branchcircular_progress_indicator_firestore_perf_issue
- Link a firebase project as described here https://firebase.google.com/docs/flutter/setup?platform=web
- Run the example app on the web
- Press create data button and wait until the text tells you to reload
- Reload the page
- Wait at least 2 minutes for the data to load
- After that we are going to delete the local cache, by going in the chrome devtools > application > indexedDB > and then delete all firestore databases.
- Close the application
- switch to the branch
network_disabled
- relaunch the application
- Press create data button and wait 30 seconds, then reload the page (the text will not change this time)
- It now takes approximately 3 seconds to load the data from cache (still a lot but an order of magnitude less than before).
When removing the flutter animation it takes even less time: