4 ms·
Ask PG: How often are the ratings for HN submissions crunched
I was just curious how it's implemented.
I know the formula is:
(p - 1) / (t + 2)^1.5
where p and t are:
p = votes (points) from users.
t = time since submission in hours.
So to reduce the load on the server, is
the calculation done every X number of
minutes? Then when you query for the
stories, do you just sort by rating desc?
- pg 18y agoIt's done per story when one's score changes after a vote, and also occasionally for random stories near the top. See the source.
- kyro 18y agoI think the equation needs to be tweaked a bit, honestly. Some of these stories that get 100+ votes stay on the front page for longer than they really should, taking up space that many other interesting, yet less popular, stories could occupy.
- pg 18y agoYeah, you're probably right. There are now so many more votes on the top stories that they do stay around longer than they used to. I just increased gravity to 1.8 and the frontpage looks better now.