Skip to content

eviction: fix LFU tie-breaking with LRU-on-ties using monotonic seq; …#43

Merged
hyp3rd merged 1 commit intomainfrom
feat/eviction-improvements
Aug 21, 2025
Merged

eviction: fix LFU tie-breaking with LRU-on-ties using monotonic seq; …#43
hyp3rd merged 1 commit intomainfrom
feat/eviction-improvements

Conversation

@hyp3rd
Copy link
Copy Markdown
Owner

@hyp3rd hyp3rd commented Aug 21, 2025

…remove ARC from default registry; docs: mark ARC experimental and list algorithm names; minor readme typo; middleware: tidy comments

…remove ARC from default registry; docs: mark ARC experimental and list algorithm names; minor readme typo; middleware: tidy comments
Copilot AI review requested due to automatic review settings August 21, 2025 10:01
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Aug 21, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request improves the LFU eviction algorithm's tie-breaking mechanism and updates documentation to clarify algorithm availability. The primary change implements proper LRU-on-ties behavior for the LFU algorithm using a monotonic sequence counter, while also removing the experimental ARC algorithm from the default registry and improving documentation clarity.

  • Fixes LFU tie-breaking to use LRU ordering instead of insertion order
  • Removes ARC from default algorithm registry and marks it as experimental
  • Updates documentation to list available algorithm names and corrects a typo

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/eviction/lfu.go Implements monotonic sequence tracking for proper LRU tie-breaking in LFU algorithm
pkg/eviction/eviction.go Removes ARC algorithm from default registry
config.go Updates package documentation to mark ARC as experimental and remove it from default list
README.md Adds algorithm names section, marks ARC as experimental, and fixes "Evitc" typo
pkg/middleware/otel_metrics.go Removes obsolete comments about function ordering

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pkg/eviction/lfu.go
freqs: &FrequencyHeap{},
length: 0,
cap: capacity,
seq: 0,
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initializing seq to 0 creates a potential issue where the first access will have sequence 1, but tie-breaking logic expects higher values to be more recent. Consider starting from 1 or documenting that 0 represents uninitialized state.

Suggested change
seq: 0,
seq: 1,

Copilot uses AI. Check for mistakes.
@hyp3rd hyp3rd merged commit 1be5936 into main Aug 21, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants