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

While scrolling every message in the chat is rebuilt which is causing performance issues #577

Closed
ghost opened this issue Mar 22, 2024 · 6 comments
Labels
question Further information is requested

Comments

@ghost
Copy link

ghost commented Mar 22, 2024

While scrolling every message in the chat is rebuilt which is causing performance issues.

So for eg. i have custom message with 3 images, every time i scroll its rebuilt which makes the app laggy and gives bad experience for the user.

Just wanted to know if the listview.builder is used in the package ? and also when this can be fixed because i feel this is a very big issue wrt performance as it crashes the app for our clients.

@ghost ghost added the question Further information is requested label Mar 22, 2024
@demchenkoalex
Copy link
Member

Hey @aronfernandes-cci with listview builder it will also be rebuilt :D I guess I do not need to describe a concept of recycling views when every list item is destroyed when going off the screen and then created from a copy when entering. This is expected.

The problem is in the poorly written code. It is simply bad. When I started all this I had minimal Flutter knowledge.

I noticed all these issues too and I basically removed all the code one day and started from scratch with all knowledge gained, on a v2 branch. There I try to use all best practices and I always check performance metrics so I know that the foundation I build on is performant. I tried showing thousands of messages on v2 branch and it was fast, where v1 lags after like 30. Unfortunately I can't provide a "fix" for v1, cause it is all bad, it was practically easier to write from scratch than fix it.

Currently I am working on fixing images being reloaded after I change message id or remove elements from the list, maybe it is something related to your own problem. I finally figured I can do a custom image provider to fix the issue, so doing exactly this now. Then I will test my solution against api, firebase and chat GPT to see that everything is performant and foundation works. Only after that I will be able to release some alpha version, but it will be super simple at first. Then I will start adding features from v1/accepting contributions and finally adding long requested stuff like replies, reactions and audio messages.

Given I spent like a month trying to fix the images I can't give you a timeline. Sometimes I will just face some blocker I don't know how to solve and will be trying a million of different things. All after my full time job and some personal life at least.

@ghost
Copy link
Author

ghost commented Mar 22, 2024

thank you for the information and help. and also problem only comes with scrolling custom messages and custom image messages. Text messages scroll very smoothly.

@Riki1200
Copy link

Riki1200 commented May 10, 2024

I suggest you customize bubbleBuilder when you try to valid type of message, for example, you can try to resize image o compress every image in the chat.
image
there's a lot method to do something for this

@robcleghorn
Copy link

Thanks for the huge effort, super grateful. How about an initial release without image support so we can all get our hands on it?

@demchenkoalex
Copy link
Member

did not work on this for the last month (lots of work) I feel I am almost there with images and will try to finish at least v2 preview in the coming month

@demchenkoalex
Copy link
Member

v2 dev build is released and I focused on performance there with as little rebuilds as possible, hopefully not an issue anymore.

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