#469 Performance: O(N log N) sorted() for cache eviction in activity_worker.py
Description
Editengine/services/activity_worker.py:120-125 uses sorted() for LRU cache eviction.
sorted() is O(N log N) when we only need the oldest K items. For large caches, this is wasteful.
FIX: Use heapq.nsmallest() which is O(N log K) where K is items to evict:
```python
import heapq
oldest_entries = heapq.nsmallest(evict_count, cache.items(), key=lambda x: x[1][1])
```
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...