Skip to content

authz: move Permissions impl into FilePermissionsFunc

Administrator requested to merge plz.review/review/11273 into main

Created by: keegancsmith

Previously FilePermissionsFunc was a wrapper around Permissions. Now instead we move the implementation into FilePermissionsFunc. This commit was implemented to preserve behaviour (including how we treat empty paths). The only difference in behaviour is that the work we can do once per repository is now cached instead of being rechecked per file. This has a large impact on the performance of FilterActorPaths

name                 old time/op  new time/op  delta
FilterActorPaths-32  1.72ms ± 4%  0.67ms ± 8%   -61.06%  (p=0.000 n=9+10)

name                 old paths/s  new paths/s  delta
FilterActorPaths-32   2.91M ± 4%   7.49M ± 8%  +157.14%  (p=0.000 n=9+10)

When viewing CPU profiles of the benchmark, it is dominated by actual path checking. This means the next large improvement will have to be algorithmic/data structure based. There is a good chance now that we are fast enough to be IO bound on how fast gitserver can respond.

Test Plan: go test

Part of https://github.com/sourcegraph/sourcegraph/issues/41347

Stacked on https://github.com/sourcegraph/sourcegraph/pull/41434

plz-review-url: https://plz.review/review/11273

Merge request reports

Loading