presidio
presidio copied to clipboard
perf: optimize conflict resolution algorithm in AnonymizerEngine
Change Description
- Replace O(n) list.remove() with O(1) set operations for tracking active indices
- Use pop() instead of remove() in whitespace merge since prev_result is always last
- Convert list comprehension to generator expression for short-circuit evaluation
- Pre-compile regex pattern to avoid repeated compilation
Issue reference
Fixes #XX
Checklist
- [x] I have reviewed the contribution guidelines
- [x] I have signed the CLA (if required)
- [x] My code includes unit tests
- [x] All unit tests and lint checks pass locally
- [ ] My PR contains documentation updates / additions if required
@microsoft-github-policy-service agree