Skip to content

perf: constant-time match lookups in standings model#7650

Open
Rathoz wants to merge 1 commit into
standings-tests-aifrom
standings-fetch-lookups
Open

perf: constant-time match lookups in standings model#7650
Rathoz wants to merge 1 commit into
standings-tests-aifrom
standings-fetch-lookups

Conversation

@Rathoz

@Rathoz Rathoz commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Standings.fetchMatches: replaced the per-match linear Table.includes scan over matchids with a set (wantedMatchIds table built via Table.map), so each match lookup is O(1) instead of O(n). Result ordering (bracket order) is unchanged.
  • Standings.fetchMatch: replaced MatchGroupUtil.fetchMatches(bracketId) + filter-all-then-pick-one with a direct MatchGroupUtil.fetchMatchGroup(bracketId).matchesById[matchid] lookup. fetchMatchGroup is already memoized, so this avoids re-filtering all bracket matches on every call. Existing nil-safety early returns are preserved.

Based on standings-tests-ai (#7647).

How did you test this change?

  • busted --run=ci: 605 successes / 0 failures / 0 errors / 0 pending
  • luacheck lua/wikis/commons/Standings.lua: 0 warnings / 0 errors

🤖 Generated with Claude Code

@Rathoz Rathoz requested review from a team as code owners June 12, 2026 14:09
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Rathoz Rathoz force-pushed the standings-fetch-lookups branch from 4b857f4 to c52fc6f Compare June 12, 2026 16: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.

3 participants