Live data from Hacker News

Why is collapsing a Hacker News comment so slow?

github.com

61–70 of 123 posts

Re: Why is collapsing a Hacker News comment so slow?

#61
post #16

I would use the tag to solve this problem. Most people don't know this exists and I have no idea why. You would probably have to rewrite the html so it no longer uses tables but I don't really consider that to be a negative. I would also question why we are saving collapsed comments. I feel like this is something that doesn't need to be persisted forever. If you want this behavior why not use local storage instead?

Persisting it on the server allows users to browse on multiple devices and keep their collapse settings in sync. This is useful in particular for long threads of comments, where collapsing can be used as a tool to keep track of progress through the thread by collapsing comments along the way.

Sure I get that this is possible given that you know this is what the code does but the bigger questions are who knows that you can do this, and who actually uses this feature?

Is this the expected behavior when you collapse or show a thread? I would suggest that it is not, as most minor interactions on a page are only stored locally.

How many people actually use this feature? In order get a benefit from this feature you have to be logged into hacker news on multiple devices, collapse a thread on one device, come back to that thread later on the second device and then continue reading from where you left off. Alternatively you can just scroll past the stuff you've already read, which has a minimal cost to the user.

The benefits seem negligible for the amount of developer time that likely went into making this feature.

Re: Why is collapsing a Hacker News comment so slow?

#62
post #58

Earlier quoted context omitted.

Considering there are millions of people still using IE11, I'd say it will continue being a problem for a long time. 18% of my users are on IE11. Some industries (healthcare, for example) don't change if they don't perceive something to be broken.

Doesn't Edge auto-update though? How easy would it be, as someone in enterprise IT, to keep users on an old version of Edge?

The reason is active-x, somebody wrote a way to scan with active-x and now virtually every healthcare web app works that way.

Re: Why is collapsing a Hacker News comment so slow?

#63
post #58

Earlier quoted context omitted.

Considering there are millions of people still using IE11, I'd say it will continue being a problem for a long time. 18% of my users are on IE11. Some industries (healthcare, for example) don't change if they don't perceive something to be broken.

Doesn't Edge auto-update though? How easy would it be, as someone in enterprise IT, to keep users on an old version of Edge?

Edge isn't IE11. They are both installed, side-by-side, on Windows 10, and IE11 is the only one that ships on Windows 7.

Re: Why is collapsing a Hacker News comment so slow?

#64
post #42
post #33

Earlier quoted context omitted.

I never realized Reddit did that. That's a really cool hack; like a poor man's version of Background Sync[1]. I guess the disadvantage of using cookies is that if you just click to vote and then close the tab, your vote might not be recorded for a long time. [1]: https://developers.google.com/web/updates/2015/12/background...

That's a pretty big downside.

They probably figure that with the amount of clicking on threads that people on reddit do that the site will capture almost everything except for that very last page you upvoted on before you closed the tab and went to bed. However, you're probably getting on reddit soon anyway and the votes will be counted then.

Re: Why is collapsing a Hacker News comment so slow?

#65
I dug into the collapsing code recently because I wanted to make a script that collapses HN threads by default. In other words, only the top-level comments would be shown at first. To me this makes more sense. If I am interested in continuing a thread, I can expand it. If I am not interested in continuing, I don't want to have to scroll past its children.

According to the comments here, maybe I would be better off implementing my own collapsing scheme.

Re: Why is collapsing a Hacker News comment so slow?

#66

> There is also a GET request to https://news.ycombinator.com/collapse?id=1234567 to save the state of the collapsed/expanded comment if the user is logged in, but it's an async request so it doesn't have an impact. Is this a correct place to use 'GET'?

Following the rules of REST is very important if you are presenting a public API to the world. If it's your own server you can do whatever you want. For example I used to work on servers for games and often there would be a single endpoint for processing one or more commands, and this would be technically a GET request regardless of what those commands did. Furthermore it's common to send application level error deta…

> If it's your own server you can do whatever you want.

This is not at all true. For example, say I'm a user in a dorm that uses a proxy that I have no control over. If you make your GET request modify things, that proxy may cache the request, or worse, may repeat the request later to maintain its cache.

My point is, you don't know what is between your server and their client, and even well behaved infrastructure will sometimes make or modify GET requests on your behalf, but won't do that with POSTs.

Re: Why is collapsing a Hacker News comment so slow?

#67
If you don't mind me being negative here for a moment:

1. It's not your website, why spend so much time and effort on dissecting the issue? If one did this for every webpage they visited it'd be a more than a full time job.

2. Does it really look like Hacker News has had any serious development effort poured into it anytime recently? What incentive does YC have to put time and money into a forum that generates zero revenue?

3. Do we really expect web browsing to be pleasant on a 3 year old budget smartphone with a Qualcomm 617?

The Moto G4 Plus is solidly in the bottom 25% of phones listed here:

https://www.androidbenchmark.net/cpumark_chart.html

Re: Why is collapsing a Hacker News comment so slow?

#68

I have a budget moto and HN comments section is completely unusable on Chrome but perfectly smooth on Firefox. Haven't explored why. On Chrome any comment section with more than about 100 comments grinds to a halt. If I try to type in a comment there's a three second delay waiting for every letter to appear.

The typing thing also happens on 4chan and reddit for me. I wonder what's causing this.

Re: Why is collapsing a Hacker News comment so slow?

#69
post #42
post #33

Earlier quoted context omitted.

I never realized Reddit did that. That's a really cool hack; like a poor man's version of Background Sync[1]. I guess the disadvantage of using cookies is that if you just click to vote and then close the tab, your vote might not be recorded for a long time. [1]: https://developers.google.com/web/updates/2015/12/background...

That's a pretty big downside.

It's fine for Reddit's purposes. Randomly losing 10% of voting interactions wouldn't be a big deal for them. Of course, that wouldn't be ok for many other applications.

Re: Why is collapsing a Hacker News comment so slow?

#70
post #33

Earlier quoted context omitted.

It does modify state on the server so I would think it should be a POST or something. even better, they could do what reddit does with upvotes/downvotes, and store that information in the user's cookie, so that it gets sent with the next request to the server.

I never realized Reddit did that. That's a really cool hack; like a poor man's version of Background Sync[1]. I guess the disadvantage of using cookies is that if you just click to vote and then close the tab, your vote might not be recorded for a long time. [1]: https://developers.google.com/web/updates/2015/12/background...

I'm pretty sure they save it in the cookie and fire off a POST at the same time in an async thread and then don't check if the request succeeded. That way it's a backup if you're on crappy internet or the server was down or something.

The cookie isn't the only way the vote gets there.

Post reply on HN