MCPcopy
hub / github.com/apache/casbin / BenchmarkHasLinkWithPatternAndDomainPatternLarge

Function BenchmarkHasLinkWithPatternAndDomainPatternLarge

role_manager_b_test.go:171–180  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

169}
170
171func BenchmarkHasLinkWithPatternAndDomainPatternLarge(b *testing.B) {
172 e, _ := NewEnforcer("examples/performance/rbac_with_pattern_large_scale_model.conf", "examples/performance/rbac_with_pattern_large_scale_policy.csv")
173 e.AddNamedMatchingFunc("g", "", util.KeyMatch4)
174 e.AddNamedDomainMatchingFunc("g", "", util.KeyMatch4)
175 rm := e.rmMap["g"]
176 b.ResetTimer()
177 for i := 0; i < b.N; i++ {
178 _, _ = rm.HasLink("staffUser1001", "staff001", "/orgs/1/sites/site001")
179 }
180}
181
182// BenchmarkConcurrentHasLinkWithMatching benchmarks concurrent HasLink performance with matching functions.
183// Performance test for concurrent access with temporary role creation.

Callers

nothing calls this directly

Calls 4

AddNamedMatchingFuncMethod · 0.95
NewEnforcerFunction · 0.85
HasLinkMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…