SUWULLC / Octal

Hacker News Client for iOS
102 stars 2 forks source link

[Performance] Multiple second delay when opening large comment views #73

Closed cstuder closed 5 years ago

cstuder commented 5 years ago

On my iPhone 6 (With a relatively recently refreshed battery) comment view with a larger number of comments, say 200+, take a minimum of four seconds to display.

Smaller comment views are faster, but still with a noticeable delay.

Might be caused by:

  1. Network delay until the comments are loaded from the server. (Could be mitigated/hidden by implementing #6)
  2. Rendering of the comment view.

Seeing how Boreal takes about half the time to load the same comment views, I suggest looking into the rendering performance as well.

(Other than that it's a beautiful app, thank you for your work!)

dangwu commented 5 years ago

Good call out. I haven't really noticed much delay on my iPhone X, but I'm not surprised to hear of slowness on an iPhone 6.

It's definitely not a rendering issue, since a small number of comments loads instantaneously, and views off-screen don't load (by nature of how UITableView's work). #6 is more for pre-loading comments to view offline later, and not really intended to increase comment loading speed. for normal use cases.

I just tried Boreal, and it is definitely super fast. I'm not sure how they're doing that. I have a feeling that they have a service component pre-fetching all the comments and then vending them super-quickly to the app via a single response. Octal is using the official Firebase API + SDK, which is not a mobile friendly API (has to fetch each individual comment one by one, traversing a tree-like structure).

luckman212 commented 5 years ago

Firebase API ... has to fetch each individual comment one by one

Wow, seriously? After reading this, performance is actually pretty amazing. Some stories have 700+ comments. So you really have to make 700 HTTP requests to build the comment tree? That seems insane (and also like it would be a big battery drainer).

dangwu commented 5 years ago

Should clarify - they aren't HTTP requests. Firebase uses web sockets underneath to stream data.

On Thu, May 9, 2019 at 11:12 PM Luke Hamburg notifications@github.com wrote:

Firebase API ... has to fetch each individual comment one by one

Wow, seriously? After reading this, performance is actually pretty amazing. Some stories have 700+ comments. So you really have to make 700 HTTP requests to build the comment tree? That seems insane (and also like it would be a big battery drainer).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dangwu/Octal/issues/73#issuecomment-491169412, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHKY34VNPVDFBM27HO6LLTPUUG6RANCNFSM4HLO3JDQ .

dangwu commented 5 years ago

This should be much better now. Let me know if you aren't seeing the performance increase!