huynhanx03 opened a new pull request, #1729:
URL: https://github.com/apache/casbin/pull/1729

   ## Overview
   
   Optimize batch policy removal by rebuilding `Policy` and `PolicyMap` once in 
`RemovePoliciesWithAffected`. The previous implementation removed each rule one 
by one and updated policy indexes after every deletion, which becomes expensive 
for large batch removals.
   
   ## Change
   
   - Remove policies in batch by collecting keys, compacting `Policy`, and 
rebuilding `PolicyMap` once.
   - Add `BenchmarkRemovePoliciesLarge` to cover batch removal performance.
   
   ## Benchmark
   
   ```text
   goos:  darwin
   goarch: arm64
   cpu:   Apple M1
   
   BenchmarkRemovePoliciesLarge
   metric      old       new      delta
   ns/op       481,529   14,657   -97.0%
   B/op        155,938   12,660   -91.9%
   allocs/op   5,159     207      -96.0%
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to