Replies: 9 comments
-
Have you done any kind of benchmark? E.g. what is the initial fps? Then scrolling fps? How complex is your HTML? It's best if you can provide a sample screen with, say, 20 items in a list view. I have to troubleshoot further to find out the root cause. Generally, things will become slower if you put other things on top of them. Rendering items separately is probably better than using a single |
Beta Was this translation helpful? Give feedback.
-
What makes you suspect the YouTube / image widget is causing it? If possible, try to replace them with a simple |
Beta Was this translation helpful? Give feedback.
-
Im going to figure out how to properly benchmark and get you some FPS soon, once I figure out how to do it. For now my benchmarking is just from my own use and feeling how it scrolls |
Beta Was this translation helpful? Give feedback.
-
I know my Youtube widget is adding significant lag because as soon as a YouTube video scrolls on screen it gets very very laggy
I actually just for fun switched to your |
Beta Was this translation helpful? Give feedback.
-
That doesn't sound good. The default implementation uses a web view to render YouTube player, which is as slow as it gets because Flutter platform view is slow and the web view is the worst. You need to check your player code to see why it's slower than a web view. You don't need any fancy benchmarking, just turn on the performance overlay and scroll around. |
Beta Was this translation helpful? Give feedback.
-
Ok this is what I came up with (running on a pixel4a) Whats most striking is the frame rendering time is really bad in those same areas with videos where its just a red bar that shoots straight to the top of the graph.
I'll keep my code separated into multiple Do you have any ideas on strategies on what I'm doing wrong here? |
Beta Was this translation helpful? Give feedback.
-
Do you have a reproducible sample yet? I think some custom widget is slowing it down. If I can take a closer look, I may be able to suggest some thing. |
Beta Was this translation helpful? Give feedback.
-
My code is massive and depends on remote json data and multiple providers, so it would not be a simple thing to demonstrate But I've come up with 2 sources of the problem:
Now as I mentioned, its hard to show my code, its very huge at this point with a lot of dependencies, providers and remote data. I tried to strip a lot of the fluff out to post here, this will obviously not run for you off the bat, but maybe you can see/understand my logic I put the widgets in order they are being used from the initial screen opening to the I tried to also use your tinhte demo you sent me previously as a sort of model
|
Beta Was this translation helpful? Give feedback.
-
I have been able to adapt your sample code to run. Do you mind sharing some HTML too? A zip of 5 to 10 items should be enough to test the scrolling. I also noticed a few scroll listener in the code, do you do anything expensive in the callback? |
Beta Was this translation helpful? Give feedback.
-
Sorry, this is more of a question that would belong in a 'discussions' area, but since we don't have one I'm putting this here, feel free to close this if you don't think its appropriate:
Ive customized my implementation and I'm at the point that I'm getting overall happy with your project and how it fits into my app.
EXCEPT for the performance/jank which is getting worse as I make my implementation more complex
My implementation is as follows
What I have here is a large
listvew.builder
, and each listitem has a few native flutter widgets, and then a piece of HTML which I'm rendering using this package (located where the second short white line with the purple textFlutterHTMLcore
)the HTML I'm rendering is of variable size and can be very short or quite long
The HTML uses
widgetFactory
to render other small widgets, render images and render YouTube videosEach screen therefore is a list of 20 or more separate instances of the
HtmlWidget
on the same screenIm doing everything in
flutter_widget_from_html_core: ^0.7.0-0
For YouTube videos I've made my own widget using
youtube_player_flutter
package which is placed into tree usingBuildOp
<-- this is easily the most damaging to my performance and introduces significant amount of lag_imgWidget
viabuildImage
(you helped me tremendously in implementing that in the past!). <-- This is the second most damaging to performance and introduces a little bit of jankAs more and more elements are getting rendered, there comes in some noticeable jank and sluggishness when scrolling
Question
htmlwidget
that contains all of the smaller pieces and my native flutter UI elements as one large sheet of html code. I would have to convert all my native flutter UI and theironTap
actions to some kind of html and they run it through the parser. Very difficult to do, but I would be willing to spend that time if it would improve performanceBeta Was this translation helpful? Give feedback.
All reactions