Skip to content
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

docs: Performance Discussions #3940

Closed
charlieforward9 opened this issue Aug 22, 2023 · 2 comments
Closed

docs: Performance Discussions #3940

charlieforward9 opened this issue Aug 22, 2023 · 2 comments
Labels
question Further information is requested

Comments

@charlieforward9
Copy link

charlieforward9 commented Aug 22, 2023

I am reading articles on state management performance and I get varying responses. I would like to keep using BLoC, but our business needs require real time performance, so I need to find the best approach:

Bloc may be slightly more performant due to its strict unidirectional data flow, which avoids unnecessary widget rebuilds.

GetX is known for its speed and performance because it uses fewer layers of abstraction compared to Bloc.

Which is correct? And more broadly, how does BLoC perform overall?

While docs would be nice, I understand there are many other tasks that precede the importance of this. Github Discussions was extremely helpful when I was learning to use ViteSSRPlugin. I would appreciate discussing BLoC-specific development in a non-issue format. As the sole app developer for my project, the open-source community has been a huge help to me.

Github Discussion seems like one of the easiest ways to promote open-source collaboration in a popular library such as this.

Thank you for your consideration.

@c0pp1ce
Copy link

c0pp1ce commented Aug 22, 2023

Generally speaking, streams should be a good choice to work with real-time data and are probably best for performance. As bloc is using them it should be able to handle your use-case. (I dont know what GetX is using under the hood)

If you face performance issues with Bloc, revisit which parts of the UI actually depend on real-time data and build up your widget tree accordingly. You can also look into (stream) transformers to try reduce the amount of events that a real-time data source adds to your bloc which also reduces the amount of rebuilds.

I am not too sure how performant Dart streams are, others may have some insight to add. If they are comparable to Java streams you could also consider doing required calculations on your real-time data within the stream which "could" be more performant than doing it in the onEvent of the bloc. Then again the performance of Java streams also comes from the fact that you can get concurrent operations out-of-the-box with them.

@charlieforward9 charlieforward9 changed the title docs: Performance / Discussions docs: Performance Discussions Aug 22, 2023
@felangel
Copy link
Owner

Hi @charlieforward9 👋

I highly recommend running your own benchmarks but generally bloc and streams should be sufficient for managing real-time updates.

Closing for now since there aren't any actionable next steps. 👍

@felangel felangel added question Further information is requested and removed documentation Documentation requested labels Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants