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

Loading reddit thread list is extremely slow in some cases. #27

Open
shobhitg opened this issue Apr 11, 2013 · 6 comments
Open

Loading reddit thread list is extremely slow in some cases. #27

shobhitg opened this issue Apr 11, 2013 · 6 comments

Comments

@shobhitg
Copy link

Loading reddit thread list is extremely slow in some cases.

If happens when the main browser on the device has lots and lots of bookmarks and history.

On my tablet Asus TF201, I have synced it up with my Google account. And due to that all my chrome bookmarks are synced with the tablet. They are around 4000 bookmarks.

The slowness happens in the call DownloadThreadsTask class.

This code causes slowness:

-           // Go through the children and get the ThingInfos
-           for (ThingListing tiContainer : data.getChildren()) {
-               // Only add entries that are threads. kind="t3"
-               if (Constants.THREAD_KIND.equals(tiContainer.getKind())) {
-                   ThingInfo ti = tiContainer.getData();
-                   ti.setClicked(Common.isClicked(mContext, ti.getUrl()));
-                   if((mSettings.getShowNSFW() || !ti.isOver_18()) && !mFilterEngine.isFiltered(ti)) {
-                       mThingInfos.add(ti);
-                   }
-               }
-           }

Common.isClicked(mContext, ti.getUrl()) is used to query Content Resolver to check against browser's history and bookmarks if the url was already visited or not.

If I comment that out the performance improves exponentially. But ofcourse then I am not able to see indication if the reddit link was visited previously or not.

I don't know yet what the solution would be. Lets discuss.

One suggestion I would like to float is this: How about we maintain a temporary cache of urls visited from within App for about last 72 hours? And we check against the cache if the url was visited or not. Local cache would be fast. Typically all the content is pretty much rotated so fast on reddit, so it would never be the case that someone would click next 10 times and not be happy about not seeing the old links as visited.

@zagaberoo
Copy link
Owner

A cache sounds like a great idea.

Really the only reason to dip into the browser history anyway is in case the user has also visited that page in their browser.

At least in my case I very seldom have overlap between my non-reddit browsing and my reddit browsing.

@shobhitg
Copy link
Author

Ok, I will try to take a stab at this cache idea tomorrow.

@shobhitg
Copy link
Author

Another way to improve performance wrt this issue is loading less number of threads in one go. Less threads means less time to figure out if they are visited or not.
And then having infinite scrolling: #15
So basically we divide up the thread loading times into smaller pieces, so user will feel that its faster.

OR

We can load less threads (like 10 of them) and automatically populate upto 200 threads in batches of 10 threads at once. We can do this even if we have a cache.

@Sirclicksalot
Copy link

Curious if this has seen any movement in the past year. I also have chrome synced to my device (Nexus 5 w/4.4.2, stock, on T-Mobile) and find that performance is generally much worse recently. I'm not enough of a programmer to know if it is explicitly this issue, but it sounds like similar symptoms.

@Unknown-Zombie
Copy link

I'd be fine if visited links weren't even marked if it meant pages loaded fast.

As it is now, pages take actual minutes to load.

@shobhitg
Copy link
Author

@Unknown-Zombie

You can download the apk here: https://gist.github.com/shobhitg/aa919c6d79b05f6ee85c

But that is a build off my machine. It is not signed and all.

If you have a build environment, then you simply have to comment one line:
ti.setClicked(Common.isClicked(mContext, ti.getUrl()));
And make your own build.

Whoever (maybe I) fixes it using a sqllite database, will have to follow the similar pattern that is being used for saved content. Posting the location for SavedContent for future reference: https://github.com/zagaberoo/diode/tree/master/src/in/shick/diode/saved

Post your results in relation to performance.

Note: You will see links visited, but that visited status would go away as soon as you change the page (by going to another sub or going to next page).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants