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

Function BenchmarkRemovePolicySmall

management_api_b_test.go:124–136  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

122}
123
124func BenchmarkRemovePolicySmall(b *testing.B) {
125 e, _ := NewEnforcer("examples/basic_model.conf")
126
127 // 100 roles, 10 resources.
128 for i := 0; i < 100; i++ {
129 _, _ = e.AddPolicy(fmt.Sprintf("user%d", i), fmt.Sprintf("data%d", i/10), "read")
130 }
131
132 b.ResetTimer()
133 for i := 0; i < b.N; i++ {
134 _, _ = e.RemovePolicy(fmt.Sprintf("user%d", rand.Intn(100)), fmt.Sprintf("data%d", rand.Intn(100)/10), "read")
135 }
136}
137
138func BenchmarkRemovePolicyMedium(b *testing.B) {
139 e, _ := NewEnforcer("examples/basic_model.conf")

Callers

nothing calls this directly

Calls 3

AddPolicyMethod · 0.95
RemovePolicyMethod · 0.95
NewEnforcerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…