tableview slower render in corona new versions!

nmichaud, yes images are loading in rendering phase (onRowRender). you know any other way to insert them in rows while you scroll??? like i said same code as before, now lags before didn’t or not important enought to complain about it (even in simulator, that never happen before only in slow devices). images are not large.

corona273, yes your right with images tableview where never smooth like if they have only text. but i think now they are even worst, to a point to complain about it. if i can’t have images on a tableview, tableview becomes useless to me.

hope corona team take a look of the code and try to optimize it (i’ve confidence they will). fluid apps are important to anyone i think.

 if i can’t have images on a tableview, tableview becomes useless to me. hope corona team take a look of the code and try to optimize it (i’ve confidence they will). fluid apps are important to anyone i think.

I suspect the way to have smooth tableview scrolling is either:

[a] Create a Corona API to the native iOS and Android widgets and use when possible. For OS X and Windows, use the current tableview.

[b] Find a way to do the image loading in a different thread; this would require tableview to be more tightly integrated into Corona SDK rather than pure lua.

That we have not seen discussions of either approach in the ~5 years tableview has been around suggests Corona does not see smooth tableview scrolling as a priority (and is very unlikely to fix it).

Hi all,

Just for your information, if you are absolutely adamant about getting the smoothest possible TableView scrolling along with images (inside rows), then you should consider pre-loading/caching the image textures either before you create the TableView, or pre-load/cache them in “batches” as you expect them to come into the TableView’s visible row range.

https://docs.coronalabs.com/guide/graphics/textureManagement.html

Note that this approach is not for the faint of heart, nor for the “average” developer. Meaning, I am  not  advising that the typical developer who wants to show images inside of TableView rows uses this method… you need to understand exactly what you’re doing, why you might need it, and how to properly manage the memory aspects involved in texture pre-loading, caching, and un-loading.

Of course, this also assumes that you have some expectation/knowledge of exactly which images will be populating the TableView at/upcoming their appearance inside the view. If there is no way to even determine that, I can’t assist you further.

Best regards,

Brent

thx brent for the suggestion, but in my case i doubt i can use this method. and btw i’m not affraid of any code challenge.

i’m downloading images from the internet, and then puting them in real time to the tableview. i can’t cache anything before, that is not there yet. i tried different aproach, to download all images first then create the tableview, but the user waits to long for the table to come, this is not pratical, and still the tableview lags after this method (ofc with this method i can use your suggestion but for the reason i told here i abandon this method).

and again, my method always worked fine for 1 year…low lag and almost 100% smooth. now with same code…high lag, 30% smooth at best. i believe tableview code is not optimized for android.

i’ve made a scrollview myself from scratch that have 0 lag with only images inside, i use that code for simple scrolls and menus, but guess i will improve it to substitue completly the tableview. by the comments here, i doubt corona will improve it’s code after all.

Brent: Thanks for the tip! I had not thought of precaching the image textures. That might help in some (but not all) situations.

carloscosta: I am in the same position as you. I’m also downloading images from the Internet. Scrollviews have 0 lag. Maybe you can download the widget code from the repository and see if anything’s changed recently? (This assumes that Corona staff are diligent about updating the repository; I presume they are.)

Hi @carloscosta, @corona273,

Just to clarify the difference you’re seeing between TableView and ScrollView, that is by design. TableViews release (discard) rows that go outside of the view and “pre-load” rows that are about to come into the view’s range. This is actually aiming toward the goal of increasing performance, although in your usage cases (randomly downloading images from the Internet with no predictable ability to cache anything), that may actually be hurting the performance somewhat. In contrast, ScrollViews just keep everything inside the view, so whatever you place in there exists outside the visible bounds of the view, yet it all still exists and you won’t see the performance lag as things are about to come into view.

Just to ponder another issue… are you 100% sure that the “lag” is not caused by the downloading of the images? If you are on-demand downloading assets, that will take considerably longer (relatively) than loading a texture into the GPU framework, and even doing that in “native land” wouldn’t likely overcome the issue, since network transmission is network transmission no matter how you slice it. In my experience, loading images into Corona’s display rarely takes long, unless the textures are extremely large. Network transmission, on the other hand, can easily cause a noticeable delay, and that will be magnified if you try to load them on-demand as the user quickly scrolls through a TableView.

Brent

thanks brent for the explanation. i’m 100% sure the “lag” is not caused by the dowloading the images. i make a copy to temp documents directory, second time i open the tableview will not go to internet, it will use the cache version, and it still lags. i saw today another post someone complaining about framerate drop, and i remember another thing that it’s not tableview related (directly). i’ve made a images slideshow with swipes, that only create the image you are seeing and when you swipe to any side, it will create both hidden images, left and right, so when you swipe you will see them, after swipe is done i remove the hidden images again…guess a little bit the same tableview is doing. the problem i saw in my code (i never saw that problem when i finished the code, i thought i didnt notice) it was micro lag, when i create the 2 hidden images i notice a micro jitter when i swipe, so i changed the code to cache the 2 hidden images, problem solved. so the problem here was creating the images…creating 2 images creates the lag not the scroll. maybe tableview problem is creating images and deleting them, like in my code. so i suspect the code needs to be improved too is display.newImageRect. i’m very sensitive to speed, so even if i can’t prove that corona is slower than before, i’ve that feeling…back in the days when i played CS, when i changed my monitor from CRT to TN panel (the fasted monitor at that time), i thought i gone back in time not going forward. i saw a major downgrade in input lag. when i moved my mouse i thought i was moving in slow motion…in crt was instant move, in tn i notice there where a micro lag there…my friends never notice the transition, i did.

Hi @carloscosta,

Thanks for the detailed observations. About how large (both pixel dimensions and file size) are the images you’re using?

Brent

images are 304x180 - ±45k  each. my tableview will only show 3 images at a time.

Hi @carloscosta,

I checked again with the engineers and they can’t imagine what might have changed to cause this apparent issue between builds. At this point, I think we’ll need to have you trim down your project to something simple which shows the difference and submit a bug report. Then we can take a look at it.

Thanks,

Brent

thanks brent, for your effort trying to help. i did trim my project down to using only simple corona code to discard any of my part added code. the problem is worst in android. in ipad 2 same code is way more smoth than in nexus 7 2013, or any other mid android device i tested. not everyone have samsungs s6 or iphones 6s, so i try to do my code to be optimized as possible to be fluid in most devices. android may have some fault because i notice all around slownest in lolipop, but it’s not all their fault, because i’ve a blackberry that i didn’t changed the OS, and i notice the code is getting slower there too. where i did notice the most slow render is creating native.newTextField/Box. try to change anchorX or anchorY in a box (in windows use ctr+r to refresh project) and you will see a jump from that box. i did my own code to correct that, but that should not ever happen using only corona code.

one way to reduce the slowness tableview is adding number of rows cached, if you tell for example 4 cache images, that means that 4 rows not visible are already created so it will be smother and the refresh will occure less time…less lag. that way the creator of the tableview have more control and can decide what’s best to that case.

if i figured out where the lag is coming from (it may not be tableview fault but creating images like i reported in preview post) i will create a bug report, like i usually do. Thanks again for the help.