Performance Improvements - Multiprocessing, local cache DB, bug fixes and more..#50
Performance Improvements - Multiprocessing, local cache DB, bug fixes and more..#50DrorDvash wants to merge 6 commits intocoffeegist:mainfrom
Conversation
- Add SQLite object cache to skip already-processed objects (by SID/DN) - Add performance CLI options: --no-cache, --cache-file, --workers, --cache-stats - Improve object initialization and enable parallel-ready ACL processing - Update README and gitignore for cleaner workflows
- Fix context-from to work with directory paths - Handle bad certificate data gracefully instead of crashing - Fix certificate chain issues - Show worker count in a single line - Set worker count to about 90% of CPU cores by default
- Use double quotes outer, single quotes inner for f-string - Works in PowerShell, bash, zsh, and other shells
Replace linear searches with dictionary lookups for delegation and OU membership resolution. This provides significant performance improvements on large datasets by reducing algorithmic complexity from O(n²) to O(1) for relationship lookups.
cd9f570 to
4674d61
Compare
|
Well, I must share those results. What used to take 2 days now finishes in under 3 hours. PR Baseline (commit 2bc8cb7):Total runtime: 49h 52m (~2 days 2 hours) After additional PR optimizations (commit a4e345a):Total runtime: 2h 44m 115GB of data were parsed in total.
|
7f47228 to
dc22e69
Compare
dc22e69 to
1f60b20
Compare



Hey! 👋
This PR adds some performance improvements to help BOFHound handle larger AD environments more efficiently, some "resume" functionality and bug fixes.
I've made it using AI, during a red team engagement. I am dealing with a huge domain (millions of objects) therefore this was needed.
What's New
Parallel ACL Processing
ACL parsing now uses multiple CPU cores instead of running single-threaded. On a test dataset, this reduced ACL processing time from hours to minutes.
Before: Single python.exe process maxing one core
After: Multiple worker processes utilizing available cores
Local Cache for Faster Updates
BOFHound now saves processed data to a local SQLite cache (
bofhound_cache.db). On the next run, it remembers what was already done and only processes new/changed objects.What gets cached:
On subsequent runs: Only new objects get parsed and their ACLs computed. Cached objects are skipped entirely.
Use cases:
--context-from domain1_output/to reuse domain1's SID mappings without recomputing them.Using

--context-fromflag:Better Visibility
New progress indicators show what's happening during long runs:
New CLI Options
Bug Fixes
cacertificateattribute)These were discovered when testing against real-world AD data that contained edge cases not present in lab environments.
Disclaimer
I was in the same spot as in #39, so I jumped in to make it easier.
I ran numerous tests and fixed the bugs I encountered, but this is still not bulletproof or perfect. Built with a vibe coding. It noticeably improves performance and QoL for me, and I hope it will help you too.