db: Optimize authzFilter code path
Created by: tsenart
Summary
This PR optimizes the authzFilter
code paths.
Benchmark
name old time/op new time/op delta
_authzFilter-16 56.2ms ± 2% 1.0ms ± 1% -98.14% (p=0.000 n=15+15)
name old alloc/op new alloc/op delta
_authzFilter-16 55.3MB ± 0% 0.5MB ± 0% -99.03% (p=0.000 n=15+14)
name old allocs/op new allocs/op delta
_authzFilter-16 65.8k ± 0% 0.0k ± 0% -99.94% (p=0.000 n=15+15)
Merge request reports
Activity
Created by: codecov[bot]
Codecov Report
Merging #4790 into master will increase coverage by
0.06%
. The diff coverage is95.51%
.@@ Coverage Diff @@ ## master #4790 +/- ## ========================================== + Coverage 48.07% 48.14% +0.06% ========================================== Files 726 726 Lines 44263 44226 -37 Branches 1761 1761 ========================================== + Hits 21281 21294 +13 + Misses 21001 20959 -42 + Partials 1981 1973 -8
Impacted Files Coverage Δ cmd/frontend/db/repos_perm.go 85.1% <100%> (+3.92%)
...rontend/internal/authz/bitbucketserver/provider.go 82.9% <100%> (+1.39%)
cmd/frontend/authz/perms.go 100% <100%> (ø)
...d/frontend/internal/authz/bitbucketserver/store.go 79.64% <100%> (-0.25%)
...cmd/frontend/internal/authz/gitlab/gitlab_oauth.go 65.88% <90.47%> (-0.47%)
.../cmd/frontend/internal/authz/gitlab/gitlab_sudo.go 72.72% <90.9%> (+1.62%)
...prise/cmd/frontend/internal/authz/github/github.go 66.97% <92.3%> (+0.15%)
... and 1 more Created by: tsenart
Got another small boost with the last commit :)
name old time/op new time/op delta _authzFilter-16 2.38ms ± 4% 1.94ms ± 4% -18.52% (p=0.000 n=15+13) name old alloc/op new alloc/op delta _authzFilter-16 3.23MB ± 0% 2.98MB ± 0% -7.61% (p=0.000 n=15+10) name old allocs/op new allocs/op delta _authzFilter-16 97.0 ± 0% 96.0 ± 0% -1.03% (p=0.000 n=15+15)
Created by: tsenart
And another.
name old time/op new time/op delta _authzFilter-16 1.99ms ± 4% 1.88ms ± 6% -5.67% (p=0.000 n=14+15) name old alloc/op new alloc/op delta _authzFilter-16 2.98MB ± 0% 2.98MB ± 0% ~ (p=0.680 n=15+14) name old allocs/op new allocs/op delta _authzFilter-16 96.0 ± 0% 96.0 ± 0% ~ (all equal)
Created by: tsenart
And at last, the previous commit brings it further down.
name old time/op new time/op delta _authzFilter-16 1.88ms ± 6% 1.26ms ± 9% -33.02% (p=0.000 n=15+15) name old alloc/op new alloc/op delta _authzFilter-16 2.98MB ± 0% 0.86MB ± 2% -71.24% (p=0.000 n=14+15) name old allocs/op new allocs/op delta _authzFilter-16 96.0 ± 0% 51.0 ± 0% -46.88% (p=0.000 n=15+15)
Created by: tsenart
Some more improvements
name old time/op new time/op delta _authzFilter-16 1.21ms ± 8% 1.05ms ± 1% -13.09% (p=0.000 n=15+15) name old alloc/op new alloc/op delta _authzFilter-16 884kB ± 1% 537kB ± 0% -39.29% (p=0.000 n=15+14) name old allocs/op new allocs/op delta _authzFilter-16 51.0 ± 0% 39.0 ± 0% -23.53% (p=0.000 n=15+15)
Please register or sign in to reply