Skip to content
Snippets Groups Projects

authz: cache prometheus metric lookup in subrepo

Created by: keegancsmith

Viewing the profile the most expensive function is getCompiledRules. Surprisingly given the cache fast path, the slowest part of this function is in fact finding the prometheus metric given a list of labels. This minor change speeds up paths/s by 30%.

name                 old time/op  new time/op  delta
FilterActorPaths-32  3.75ms ± 7%  2.83ms ± 2%  -24.54%  (p=0.000 n=10+9)

name                 old paths/s  new paths/s  delta
FilterActorPaths-32   1.33M ± 7%   1.77M ± 3%  +32.37%  (p=0.000 n=10+9)

A deeper change is needed here where we cache most of the work here once per request, rather than doing it per file path. This requires a bit of refactoring, so just taking the quick wins from the benchmark first :)

Test Plan: go test

Merge request reports

Approval is optional

Merged by avatar (Nov 7, 2025 2:28am UTC)

Merge details

  • Changes merged into main with c34043da.
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading