Speed up last long reply sorting.

This commit is contained in:
ccd0 2017-08-12 10:00:07 -07:00
parent 6a411ff203
commit e02e5a4f2d

View File

@ -817,8 +817,11 @@ Index =
if len >= Index.lastLongThresholds[+!!r.ext] if len >= Index.lastLongThresholds[+!!r.ext]
return r return r
if thread.omitted_posts then thread.last_replies[0] else thread if thread.omitted_posts then thread.last_replies[0] else thread
lastlongD = {}
for thread in liveThreadData
lastlongD[thread.no] = lastlong(thread).no
[liveThreadData...].sort((a, b) -> [liveThreadData...].sort((a, b) ->
lastlong(b).no - lastlong(a).no lastlongD[b.no] - lastlongD[a.no]
).map (post) -> post.no ).map (post) -> post.no
when 'bump' then liveThreadIDs when 'bump' then liveThreadIDs
when 'birth' then [liveThreadIDs... ].sort (a, b) -> b - a when 'birth' then [liveThreadIDs... ].sort (a, b) -> b - a