# How does the repositioning of starred messages work?

I just starred an already-starred message over at RPG General Chat, and the message moved up by four spaces. Normally, I only see two or three spaces, but it was underneath a pile of highly-starred messages.

This has confused me for some time; a good portion of me expects some linear algorithm, such as "one star means move up one space," but the behavior doesn't seem to follow any pattern I have yet found.

And I'm not going to go star a bunch of random messages to figure it out (as much as I'd love to).

Is there any way to tell how far up a message will move when I star it?

For reference, the message I starred had two stars, and was bumped to three. It was underneath a message with five stars and another with three, and above that, two.

Just like the "hot questions" on the Q&A sites, it's based on the Hacker News formula. Starred messages are sorted in descending order by

```   Stars
-----------
(Age + 2)1.5
```

where `Age` is the message age in minutes. So there's indeed a time decay factor (e.g. a 20-minute old message with 5 stars is roughly "worth" the same as a 10-minute old message with 2 stars).

As far as I've seen, the messages stay in their current positions until moved by further starred messages.

is correct as well. The starred messages in the sidebar are re-arranged only when something actually happens (usually, when a message is starred), so the list may not always show the current "ranking". Changing the order in intervals would just create visual noise without really giving new information.

Fun fact: In August, I had to add a cast to the formula's denominator: The "starred messages" list in the oldest chat room that's still being used (the company-internal room in which we talk about development of the chat itself) started throwing exceptions. The oldest starred message in that room is from June 24, 2010, and that means on August 23, 2013, the value `(Age + 2)1.5` overflowed the range of a signed 32-bit integer.

• Wheel of blame says: "C# It's C#'s fault!" Looks like you dodged a bullet there balpha. As an aside, how do pinned messages factor in to it? Are they always on top until unpinned?
– jmac
Nov 11, 2013 at 7:24
• @jmac Yes, pinned messages are sorted to the top, and within multiple pinned messages, the same sorting applies.
– balpha StaffMod
Nov 11, 2013 at 7:32
• (cc @jmac) jsfiddle.net/AYPpF/96/embedded/result Nov 11, 2013 at 7:39

There's a time decay factor in the ranking.

The older the message, the further down it falls. The more stars it has, the further up it's pushed.

I don't believe anybody has ever disclosed the exact algorithm, but that's the gist of it.

Note that many things work the same way: "Hot questions" list, Reddit, etc...

• Where am I wrong? Oct 12, 2013 at 6:07
• As far as I've seen, the messages stay in their current positions until moved by further starred messages.
– user206222
Oct 12, 2013 at 6:07
• For reference, the message I starred had two stars, and was bumped to three. It was previously underneath a message with five stars and another with three, and above that, two. (edited into main post)
– user206222
Oct 12, 2013 at 6:08
• Then you haven't observed long enough. (or the room is very inactive) Even if nothing new gets starred, they will rearrange themselves every once in a while. (due to time decay) Oct 12, 2013 at 6:08
• Hmm... I'm not going to downvote (or the room is too active to tell). Thanks for the answer! It does help, even if it isn't a direct answer. Sorry for the confusion.
– user206222
Oct 12, 2013 at 6:10
• If you sit long enough, you'll notice that message with tons of stars will float to the top above the new ones with few stars. Though I admit that the only room where I see this often is the C++ room. (Currently, the message with 14 stars by Jerry Coffin floated above mine with only 4 stars about an hour or so ago. Mine was on top for a while and I don't believe any new stars were added in the meantime.) Oct 12, 2013 at 6:13
• Hrm... I wonder why that would be. That doesn't make much sense for an algorithm, as far as I can tell; seems easier just to recalculate the list or something. That's why I'm confused as to where a star will move a comment.
– user206222
Oct 12, 2013 at 6:16
• If I had to guess, they recalculate the positions every time a new star is added and once an hour otherwise. The multicollider questions list ("hot questions") have their time-decay factors updated on the top of every hour. Oct 12, 2013 at 6:19
• @Emrakul: It could be logarithmic; it makes perfect sense to have a very recent 'hot' message float above an older popular message for a while based on quick flagging. But as time goes by, the one with 14 stars goes back up as the 'flash in the pan' decays without further flags. Oct 12, 2013 at 7:54