News for hackers. Stuff that matters.
Re:Tell HN: Thank you for not redesigning Hacker News by FreeHugs on Sunday September 01, 2019 @05:02PM (#20854869)

    This means that every vote results in a
    response that's usually around 10KB gzipped
I have Facebook open in another window and opened the network inspector to compare it:

Just moving the mouse towards the like button created 824KB of data transfer. Not sure if it is because of tracking the mouse movement or if it preloads stuff it thinks my mouse is moving towards. Or maybe it loads stuff that it would display if I held the mouse over something longer. No idea. But it loaded 824KB without me interacting with anything. Just because I moved the mouse.

The actual click on the like button added 30KB on top of that.

Re:Tell HN: Thank you for not redesigning Hacker News by Deimorz on Sunday September 01, 2019 @06:42PM (#20855491)
Sure, of course it can be much worse, and almost all other sites are. I'm just saying that HN could do it better, because there's no need for it to send a redirect or that full-page response unless the user has JS disabled.

With JS, they could send a completely empty HTTP 200 response and it would work exactly the same (it does nothing with the response anyway). Right now HN is probably sending multiple gigabytes worth of responses to voting every day that are all just thrown away.

Re:Tell HN: Thank you for not redesigning Hacker News by noobermin on Sunday September 01, 2019 @09:03PM (#20856003)
>almost all other sites are.

That's their point. You're not wrong, you can always be better, but HN is barebones compared to almost all (using the mathematical definition...alright, facetiously using it) other sites.

Re:Tell HN: Thank you for not redesigning Hacker News by drusepth on Monday September 02, 2019 @12:12AM (#20856724)
Comparing to Facebook is probably the worst possible comparison, though, and doesn't seem representative of most other sites.
Re:Tell HN: Thank you for not redesigning Hacker News by GoblinSlayer on Monday September 02, 2019 @05:01AM (#20857751)
Only a very few sites are not bloated Facebook clone abominations.
Re:Tell HN: Thank you for not redesigning Hacker News by netfl0 on Sunday September 01, 2019 @10:39PM (#20856393)
He is wrong. It is not “quite bad”.

I appreciate your generosity to him but I am sad to see that is the top comment.

Re:Tell HN: Thank you for not redesigning Hacker News by Deimorz on Sunday September 01, 2019 @10:59PM (#20856476)
How could it possibly be considered a good thing? I've seen dang say before that they've been running into performance issues, and I bet that they'd see a significant drop in resource usage solely by not generating entire comments pages just to throw them away every time anyone votes on a comment. The response is literally not used at all, they're doing that work and sending that data for no reason.

There are multiple downsides and not a single benefit to the current method.

Re:Tell HN: Thank you for not redesigning Hacker News by samtheprogram on Sunday September 01, 2019 @11:55PM (#20856668)
It's implemented this way for balance of a simple implementation and how lightweight it is. Not to mention, there is at least one benefit: the voting mechanism doesn't depend on JavaScript.

And if you are not authenticated, you are instead taken to a login page. Logging in then gives you the redirect and the upvote is registered.

Re:Tell HN: Thank you for not redesigning Hacker News by 171243 on Monday September 02, 2019 @12:28AM (#20856775)
So just to clarify, this behavior seems to be by design. In that case it does seem the original comment is objectively wrong if the code is readable and maintainable and accomplishes the desired behavior.
Re:Tell HN: Thank you for not redesigning Hacker News by csande17 on Monday September 02, 2019 @01:26AM (#20856947)
As parent comments mention, sending back the whole-page response when you vote on a comment is a great idea if you have JavaScript disabled or aren't logged in.

But it'd be a quick performance win if it didn't do that when you were logged in with JavaScript enabled. The actual JavaScript part of this is actually already implemented -- that's why the page doesn't refresh when you upvote my comment -- so you'd just need one if-statement on the server side to send a blank response instead of a redirect.

Sure, 10 KB of download and the server CPU time needed to re-generate the listing page is probably pretty negligible, but multiply that by the number of votes casted on Hacker News every day and it starts to add up.

Re:Tell HN: Thank you for not redesigning Hacker News by Deimorz on Monday September 02, 2019 @01:45AM (#20857013)
Exactly, and it even adds up quickly for a single user in common cases like voting on a bunch of comments while reading a thread.

If someone loads this thread right now, the initial page load is 61KB (gzipped). If they read down the thread and vote on 30 comments while they're doing it, they transfer an additional 480KB (16KB/vote [1]). There's no reason that they should be receiving 8x more data by voting on a relatively low number of comments (~10% of the thread) than they did when loading the entire page originally. It also has to re-generate the page an extra 30 times unnecessarily - a repeatedly voting user becomes like a heavy multiplier to your traffic.

[1]: Also, I just noticed that the responses back from voting actually aren't the full page, they're truncated. It seems like maybe the response size is capped at 16KB gzipped? That implies that there's already some kind of special handling for the voting responses.

Re:Tell HN: Thank you for not redesigning Hacker News by southerntofu on Monday September 02, 2019 @05:31AM (#20857876)
From what i can see, the response only contains the comment you upvoted and its children. It's important for people like me who don't have Javascript, but the JS voting system could probably do with a simple HEAD request.
Re:Tell HN: Thank you for not redesigning Hacker News by TeMPOraL on Monday September 02, 2019 @03:13AM (#20857300)
Seconding. Sending back the whole page on AJAX upvote seems unnecessarily wasteful, and sounds like something trivially fixable.

Taking data from 2.5 years ago[0], HN has ~300k daily uniques. Assuming 10% of that are users, each upvoting one story, that's 30k unnecessary page renders per day. That's ~2% of the total views (though the more expensive views - AFAIK when you're logged out, you get cached pages?), so on the one hand it's not much, but on the other hand the fix should be trivial and have minimal impact on code readability.

--

[0] - https://news.ycombinator.com/item?id=9220098

Re:Tell HN: Thank you for not redesigning Hacker News by zzo38computer on Monday September 02, 2019 @04:58PM (#20861725)
It is possible to do both. Such as, have the link like it is now, but add a JavaScript code which replaces the link with one that executes the JavaScript code to make a request that returns nothing (if you are logged in). If JavaScript is disabled or unimplemented, it will still work.
Re:Tell HN: Thank you for not redesigning Hacker News by jbverschoor on Monday September 02, 2019 @03:21AM (#20857331)
You can return NO_CONTENT on a successful request, and the browser will do nothing.
Re:Tell HN: Thank you for not redesigning Hacker News by roenxi on Monday September 02, 2019 @03:22AM (#20857334)
> How could it possibly be considered a good thing?

It will work with any possible browser under any reasonably foreseeable condition with no maintenance on the part of the HN crew.

> I bet that they'd see a significant drop in resource usage solely by not generating entire comments pages just to throw them away every time anyone votes on a comment.

If there is a serious performance problem they will presumably do some analysis and make changes related to the most serious bottleneck.

> There are multiple downsides

There are multiple irrelevant hypotheticals. If anyone cares about the heavy-weight HN, I hope they don't accidentally click the link to the article and discover the wider internet with images and whatnot.

Re:Tell HN: Thank you for not redesigning Hacker News by neop1x on Monday September 02, 2019 @05:38AM (#20857903)
True. And I can see that some webs gradually stop working if you are using JS blockers. For example Aliexpress used to work fine with uMatrix. Now, if I click on the Next page in the paginator, it behaves like it loaded the next page, jumps to top, but it didn't - it just changed URL location. So I have to CTRL+R to reload the whole page to force their server-side rendering. I know it is theoretically my problem but I have to use JS blocking to stop (for me useless) ads and malware scripts. If they just loaded content from their domain or sub-domains, it would work perfectly fine. And if it were old-school server-rendered website, it would probably work faster, as it was discussed here some time ago. I have a feeling that web devs are sometimes over-engineering it. Web browser is HTML viewer, not an operating system.
Re:Tell HN: Thank you for not redesigning Hacker News by acangiano on Sunday September 01, 2019 @08:01PM (#20855781)
I have a gigabit Internet connection with top of the line laptops and Facebook still makes me wait for a second or two simply to show me 5 notifications.
Re:Tell HN: Thank you for not redesigning Hacker News by colejohnson66 on Monday September 02, 2019 @04:52PM (#20861678)
You may have gigabit, but what’s your ping time?
Re:Tell HN: Thank you for not redesigning Hacker News by acangiano on Tuesday September 03, 2019 @03:22AM (#20864308)
To Facebook.com, about 25 ms.
Re:Tell HN: Thank you for not redesigning Hacker News by p3st1l3nt on Sunday September 01, 2019 @06:14PM (#20855355)
They might be tracking your browsing habits. For instance if you hover over the like button and rest the cursor there for a moment but you subsequently don't like the post, it could mean that you thought of liking that post but you did not do it for whatever reason. Or they are just prefetching pages.
Re:Tell HN: Thank you for not redesigning Hacker News by quickthrower2 on Monday September 02, 2019 @09:10PM (#20862933)
This is a diversion to the point being made.

Facebook is a very different site, and could be lazy loading anything, and do you know the mouse move was causal? was there a window.setTimeout initiating it?. Facebook is not a site i'd expect to use on a low bandwidth connection, or if I did I'd use a low bandwidth version if possible (like Gmail has a HTML only version).

Re:Tell HN: Thank you for not redesigning Hacker News by manojlds on Sunday September 01, 2019 @11:21PM (#20856536)
In lower internet speeds Facebook loads a lite version which is super fast (loads better than HN for me) and has most of the basic functionalities.
Re:Tell HN: Thank you for not redesigning Hacker News by throwawaypls on Sunday September 01, 2019 @11:31PM (#20856578)
For anyone curious, http://mbasic.facebook.com/ is one of the least data-intensive way to access facebook.
Re:Tell HN: Thank you for not redesigning Hacker News by zem on Monday September 02, 2019 @01:49AM (#20857027)
it also lets you access your messages from a phone
Re:Tell HN: Thank you for not redesigning Hacker News by JeanMarcS on Monday September 02, 2019 @03:20AM (#20857329)
This exactly.

No need for an app or anything.

I’ve been using mbasic on my phone since I read about it here in HN (Thanks HN !), it’s perfect and less intrusive.

Re:Tell HN: Thank you for not redesigning Hacker News by JaRail on Monday September 02, 2019 @01:03AM (#20856865)
The actual like is pretty small, about half a KB. Just a light graphql query that responds with updated counts for different reactions (happy/sad/etc). They definitely batch it with some other stuff though. Batching is really important for browser performance.
Re:Tell HN: Thank you for not redesigning Hacker News by Hmaal on Monday September 02, 2019 @01:05PM (#20860403)
Does this explain why my votes on mobile often don't go through on the first click?
Re:Tell HN: Thank you for not redesigning Hacker News by phjesusthatguy3 on Sunday September 01, 2019 @09:47PM (#20856200)
You don't have to use the actual words "what about" in your whataboutism post.
Re:Tell HN: Thank you for not redesigning Hacker News by phjesusthatguy3 on Sunday September 01, 2019 @09:54PM (#20856228)
Let's put it this way: if HN cleaned up their act, the next time "whatabout facebook?" came up, there would be a larger delta to whatabout.