-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jank due to DeepCollectionEquality inside ferry_cache #394
Comments
Hi! Yes, this is an issue that I ran into myself. But it's on my list of things to tackle. I want to look for potential performance improvements to make this less harmful in general, add escape hatches like The timeframe for this is weeks though, so for the short term, you probably will have to find some workaround. |
Hi @knaeckeKami I totally missed the Stream<Set<String>> operationDataChangeStream<TData, TVars>(
...
return stream
.distinct(
(prev, next) => const DeepCollectionEquality().equals(
prev,
next,
),
)
.doOnData((_) => changed.add(dataId)); To : return stream.doOnData((_) => changed.add(dataId)); As of now I have a fork of the |
You can use your fork for now. I will do some more research if it's safe to remove the .distinct() call without impact on other features like optimistic patches etc. |
I am working on a workaround for this issue on feature/cache-deduplication-strategy. It's very much experimental right now and if this gets merged into stable, the naming will likely change. The changes are in the packages ferry_exec, ferry_cache and and ferry_generator. (you need to rerun code gen) You can control the behaviour by setting the
If you want, you can try it out :). I would be curious if .afterDenormalize also fixes your jank issues. |
Ok, thanks for the quick action! I'll give it a try and will give you some feedback on the performance |
Cool. I added some additional changes just now (debouncing so every writeQuery/writeFragment only causes one update when the using |
Hi @knaeckeKami , oddly enough when I override the dependencies for Fragment of pubspec.lock ferry:
dependency: transitive
description:
name: ferry
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.5"
ferry_cache:
dependency: transitive
description:
name: ferry_cache
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+1"
ferry_exec:
dependency: "direct overridden"
description:
name: ferry_exec
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0-dev.0"
ferry_flutter:
dependency: "direct main"
description:
name: ferry_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.0-dev.0"
ferry_generator:
dependency: "direct dev"
description:
name: ferry_generator
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.0"
ferry_hive_store:
dependency: "direct main"
description:
name: ferry_hive_store
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.4"
ferry_store:
dependency: transitive
description:
name: ferry_store
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.5" |
Good to hear! Just so you know: there is an issue on unreleased versions, including the cacheDeduplicationStrategy branch, that might cause a watched stream not to update correctly in some edge cases. It will soon be fixed by #403. |
As far as I know #403 was just merged, and the initial jank I reported is non existent in the latest branches of the project. I think this issue can be closed as soon as a new version is published to pub. |
Yes, I just merged it, and I will work on getting this over the finish line next. |
While debugging I found out that the majority of the CPU time was spent
ferry/packages/ferry_cache/lib/src/operation_data_change_stream.dart
Line 78 in 0c3cccc
It seems to be somewhat related to zino-hofmann/graphql-flutter#1196 . One of the potential workarounds is to bypass the cache altogether zino-hofmann/graphql-flutter#1196 (comment) setting
alwaysRebroadcast: true
in the client. Because the comparison is taking a lot of time.The text was updated successfully, but these errors were encountered: