jurialmunkey / plugin.video.themoviedb.helper

GNU General Public License v3.0
200 stars 94 forks source link

Enhancement. Allow more than 20 #387

Closed JayDee696969 closed 3 years ago

JayDee696969 commented 3 years ago

It would be nice to be able to scroll through more than 20 Trakt items in a widget. I checked the show next page option in settings, but that just opens another page and exits the widget. The max for Xonfluence skin is set for 100. I dont notice a considerable speed difference even when displaying 100 with other addons, so it would be nice to add the option to settings to allow more. Thanks!

jurialmunkey commented 3 years ago

I've covered this many times before. The issue is that it is a waste of requests on items that are likely never going to be viewed. For instance, imagine you have a widget that pulls a random Trakt list. At most you'd have ten items visible on screen at once. If you don't scroll that widget this load cycle, that's 90 wasted requests to each service for items that are never even seen. The solution is Kodi core changing to allow plugins to update containers with new items as the user scrolls, not loading 100s of items all at once.

For an example of the speed cost, here's a little test for 15 items that I ran on an i7 16gb with a 100Mbps internet connection:

0.904 sec - Online: Star Wars: Episode I - The Phantom Menace
0.549 sec - Online: Star Wars: Episode II - Attack of the Clones
0.434 sec - Online: Star Wars: The Clone Wars
0.566 sec - Online: Star Wars: Episode III - Revenge of the Sith
0.702 sec - Online: Solo: A Star Wars Story
0.376 sec - Online: Star Wars Rebels: Spark of Rebellion
0.485 sec - Online: Star Wars Rebels: The Siege of Lothal
0.022 sec - Cached: Rogue One: A Star Wars Story
0.008 sec - Cached: Star Wars
0.007 sec - Cached: The Empire Strikes Back
0.544 sec - Online: Return of the Jedi
0.005 sec - Cached: The Mandalorian
0.020 sec - Cached: Star Wars: The Force Awakens
0.682 sec - Online: Star Wars: The Last Jedi
0.702 sec - Online: Star Wars: The Rise of Skywalker

Cached AVG: 0.013 sec
Online AVG: 0.594 sec
Total Time: 6.007 sec

As you can see, retrieving cached details is blazing fast but when the online lookup needs to happen we're looking at more than half a second each time. And this is on a fast CPU and internet connection and with FanartTv lookups turned off.

For 100 items that's going to be a minute for just the item lookups (I'm not measuring any other overhead here, just the actual building of the individual item).