Skip to content

fix(leaderboards): use a Map for rankings lookups - #1008

Merged
ugcodrr merged 3 commits into
mainfrom
fix/rankings-lookups
Nov 1, 2026
Merged

ugcodrr merged 3 commits into
mainfrom
fix/rankings-lookups

Conversation

@ugcodrr

@ugcodrr ugcodrr commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Description: Rankings requests searched all 3,775 Player fields for each field they asked about.

  1. Looking up all 2,718 leaderboard fields takes about 0.1 ms instead of 10 ms.

Merge order for the perf PRs is in #1002.

Testing: POST /player/leaderboards/rankings with every field. The body matches main's.

@IsEnum(fields, { each: true }) rebuilt the list of all 2,718 player leaderboard
fields for every value, and getLeaderboardField searched the metadata array for
each field. Validate against a Set with IsEnum's message, and look fields up in
a Map built once per class. A test checks that scanMetadata returns each Player
and Guild key once, since a Map keeps the last entry for a repeated key.
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
statsify Ignored Ignored Oct 22, 2026 6:02am UTC

@ugcodrr ugcodrr changed the title fix(leaderboards): use a Set and a Map for rankings lookups fix(leaderboards): use a Map for rankings lookups Oct 22, 2026

@momenazhar momenazhar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtj

@ugcodrr
ugcodrr merged commit 6726f1a into main Nov 1, 2026
4 checks passed
@ugcodrr
ugcodrr deleted the fix/rankings-lookups branch November 1, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants