mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-31 01:42:27 +00:00
perf: throttle trusted mute pruning
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
d569e1474e
commit
f7ebad4b2f
6 files changed
+9451
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# Weekly Perf Deep Dive Agent - Completed
|
||||
|
||||
**Agent:** perf-deepdive-agent
|
||||
**Date:** 2026-02-21
|
||||
**Cadence:** Weekly
|
||||
|
||||
## Summary
|
||||
Executed a performance deep dive focusing on the Moderation Service.
|
||||
|
||||
### Tasks
|
||||
1. **Exploration:** Identified `moderationStage` and `moderationService` as potential hotspots due to repeated lookups in the feed loop.
|
||||
2. **Benchmarking:** Created `benchmarks/moderation_stage_bench.js` and `benchmarks/moderation_service_bench.js`.
|
||||
- Baseline for service lookups: ~39ms for 10k reads.
|
||||
3. **Optimization:** Identified that `getActiveTrustedMutersForAuthor` was performing an O(N) prune operation on every read.
|
||||
- Implemented "Lazy Pruning" in `js/services/moderationService.js`, throttling the prune to run at most once per minute per author.
|
||||
4. **Verification:**
|
||||
- Re-ran benchmarks: Latency reduced to ~22ms (~43% improvement).
|
||||
- Verified logic with `tests/moderation/*.test.mjs`.
|
||||
- Confirmed file size compliance (after minor adjustment).
|
||||
|
||||
## Artifacts
|
||||
- `weekly-perf-report-2026-02-21.md`
|
||||
- `benchmarks/moderation_stage_bench.js`
|
||||
- `benchmarks/moderation_service_bench.js`
|
||||
- `perf/hits-2026-02-21.json`
|
||||
|
||||
## Next Steps
|
||||
- Consider further optimizing `moderationStage` by batching author lookups.
|
||||
Reference in new issue
Block a user