Closed
Description
Operating System
macOS Sequoia 15.2
Environment (if applicable)
Arc
Firebase SDK Version
11.3.0
Firebase SDK Product(s)
Firestore
Project Tooling
Vite
Detailed Problem Description
Since the update to 11.3.0 our app became very unresponsive and CPU intensive. A downgrade to 11.2.0 fixes the problem.
Steps and code to reproduce issue
Upgrade from 11.2.0 to 11.3.0
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
google-oss-bot commentedon Feb 7, 2025
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
dlarocque commentedon Feb 7, 2025
Hi @apeiniger, thanks for reporting this issue. It's really helpful to know that this issue only occurs in 11.3.0. This may be related to #8691. Could you confirm whether your app reaches the code path
compareUtf8Strings()
? If not, please share what other products are used in your app.Also, if possible, could you provide a minimal app that is affected by this performance issue?
apeiniger commentedon Feb 8, 2025
@dlarocque What is the easiest way to find out if our app reaches the mentioned code path?
We mainly use Authentication and Firestore. On the Firestore side we have about 10 onSnapshot calls running in parallel, otherwise it's only standard Firestore calls.
milaGGL commentedon Feb 10, 2025
Hi @apeiniger, we are quite confirmative that the performance issue is created by the utf-8 encoded string comparison. Before a patch is added, please downgrade to Version 11.2.0. Sorry for the inconvenience.
Besides, would you be willing to try out a special release when a fix is added? That would be very helpful.
apeiniger commentedon Feb 11, 2025
@milaGGL Sure, happy to try out a special release once it's there. Just let me know.
lars-w-pedersen commentedon Feb 11, 2025
I have the same issue and can reproduce it with this code:
<!DOCTYPE html>
<html>
<head>
<script src="https://www.gstatic.com/firebasejs/11.3.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/11.3.0/firebase-firestore-compat.js"></script>
</head>
<body>
<script type="text/javascript">
const firebaseConfig = {...};
const app = firebase.initializeApp(firebaseConfig);
const db = firebase.firestore();
var i = 0;
//start timer
console.time("fetching data");
db.collection("users/1ODZLpoiftVBrNQ1piJwfdrc6GK2/experiments/mc1-1#2022-09-01T12:00:00.000Z/measurements").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
i++;
});
console.log(i);
//end timer
console.timeEnd("fetching data");
});
</script>
</body>
</html>
"users/1ODZLpoiftVBrNQ1piJwfdrc6GK2/experiments/mc1-1#2022-09-01T12:00:00.000Z/measurements" is a subcollection with 1000 documents that has a timestamp as id, and 2 properties "p" and "t" both numbers.
using 11.3.0 it takes 7000ms to fetch them, using 11.2.0 it only takes 700ms
lars-w-pedersen commentedon Feb 11, 2025
11.3.1 does not have the issue, nice :)
dlarocque commentedon Feb 11, 2025
Thanks for confirming! That was fast- I just released it 😅
Before closing this issue, @apeiniger could you confirm that this performance issue is gone after upgrading to 11.3.1?
apeiniger commentedon Feb 12, 2025
@dlarocque Seems to be fixed for me as well. Thanks for the quick turnaround.
dlarocque commentedon Feb 12, 2025
That's great to hear! Thanks for confirming.
milaGGL commentedon Feb 14, 2025
Hi @apeiniger , could you please help custom build and test this fix out? A lazy encoding is used instead of original "encode them all first" method. Hopefully, this should be able to do the UTF-8 encoded string comparison without dragging the performance down.