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

Function BenchmarkConcurrentHasLinkWithMatching

role_manager_b_test.go:184–195  ·  view source on GitHub ↗

BenchmarkConcurrentHasLinkWithMatching benchmarks concurrent HasLink performance with matching functions. Performance test for concurrent access with temporary role creation.

(b *testing.B)

Source from the content-addressed store, hash-verified

182// BenchmarkConcurrentHasLinkWithMatching benchmarks concurrent HasLink performance with matching functions.
183// Performance test for concurrent access with temporary role creation.
184func BenchmarkConcurrentHasLinkWithMatching(b *testing.B) {
185 e, _ := NewEnforcer("examples/rbac_with_pattern_model.conf", "examples/rbac_with_pattern_policy.csv")
186 e.AddNamedMatchingFunc("g2", "keyMatch2", util.KeyMatch2)
187 rm := e.GetRoleManager()
188
189 b.ResetTimer()
190 b.RunParallel(func(pb *testing.PB) {
191 for pb.Next() {
192 _, _ = rm.HasLink("alice", "/book/123")
193 }
194 })
195}

Callers

nothing calls this directly

Calls 4

AddNamedMatchingFuncMethod · 0.95
GetRoleManagerMethod · 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…