Closed jinyus closed 9 months ago
Linux on release profile
Screenshots taken ~10s after avg
stops increasing
Thanks for your contribution! It is very welcome. I'll adjust some version constraints and merge it when I have some spare time soon.
Here's the video with 1k subscriptions.
Beacon: 9ms/frame 110 fps
Signal: 28.5ms/frame 35 fps
Mobx: 29ms/frame 34.5 fps
https://github.com/s0nerik/context_watch/assets/30532952/d5113ac6-e9c7-4563-b84e-392321d232e2
Hey @jinyus , the PR is merged now, thanks again for your contribution. I have one question though. Considering that the beacon
package has in-built watch(context)
extension that seems to work in a performant fashion, do you think there's a need for context_watch_beacon
package at all?
Maybe not, if it's already compatible then I don't see the benefit.
edit: I didn't even realize that context_watch provided a different implementation. I thought it was just a wrapper. On my machine signals.watch hangs up. The videos I posted were using the context_watch version.
Update:
Yeah, the context_watch
version is slower 28ms vs 9ms
; I forgot to add it so the numbers from the videos were comparing context_watch
versions of signal and mobx to the built in beacon.watch
.
Your package seems to be much faster than signals and mobx. Signals freezes and mobx is 135ms/frame with their built in methods.
Yeah, the context_watch version is slower 28ms vs 9ms; I forgot to add it so the numbers from the videos were comparing context_watch versions of signal and mobx to the built in beacon.watch.
That's a bit surprising for me. Beacon seems to be the first observable type that gives >1.3x execution time difference factor consistently on my device when context_watch
is compared to it. Seems like there's, potentially, some more room for optimization for context_watch
then. Will study the reasons why Beacon
is so fast. Thanks!
HashSet and LinkedHashSet are the secret weapons.
BTW, since Beacon
implements ValueListenable
(apart from no advantage over the native watch()
extension), there's no point in having a context_watch_beacon
package since ValueListenable.watch(context)
is already a part of core context_watch
.
I think all observable types for Flutter should implement ValueListenable
, as Beacon
does. Overall, Beacon
's APIs and implementations are the closest to what I consider optimal for rich observable data types. So, kudos on that!
Thanks for the kind words, it was a trade off because now it can't be used in pure dart code. I'm open to collaboration/PRs btw :).
Hey, I hope you don't mind adding my pkg (state_beacon) to the mix. It seems to be a bit faster than mobx.
I'm not sure I did everything correctly; I just copied the code for the
signals
implementation since they have a very similar API...but most of the work is done. Let me know if there's anything else that needs to be done.