Skip to content

Conversation

@github-actions
Copy link
Contributor

This PR synchronizes the latest changes from the upstream repository https://github.com/pmcgleenon/heavykeeper-rs into the fastly-stable branch.

Upstream commit: 60f3a8c

⚠️ Note: This PR contains merge conflicts that need to be resolved manually.

Please review the changes and merge if appropriate.

dependabot bot and others added 15 commits August 11, 2025 19:20
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](bheisler/criterion.rs@0.6.0...0.7.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-version: 0.7.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…ons/checkout-5

chore(deps): bump actions/checkout from 4 to 5
chore(deps): update criterion requirement from 0.6.0 to 0.7.0
Use full u64::MAX range for decay thresholds so decay = 1.0 yields probability ~= 1.0 instead of 0.5.
Adjust extrapolated thresholds to stay normalized in [0,1] with the same scaling as precomputed entries.
Add test_decay_probability_scaling_fix to verify old behavior (no decay at rand = 2^63) and new behavior (always decay) for decay = 1.0

This bug made the decay in HeavyKeeper only half as strong as intended, so old or noisy items stuck around in the sketch much longer than they should.

In practice that means top-k results were slower to react to changes, more polluted by outdated flows, and harder to tune, because the decay parameter no longer matched the behavior described in the HeavyKeeper paper.

This fix restores the correct probability scale so decay behaves as configured, making the sketch more accurate.
Fix decay probability scaling + add test
Refactor TopKQueue::iter to use heap indices stored in the items map, eliminating O(k) scans of the heap per comparison.
Reduce overall complexity from effectively O(k^2) to O(k log k) while preserving ordering semantics (count desc, sequence asc).
Add a Criterion benchmark (topk_list) that fills a large-k TopK and repeatedly calls list() to exercise and measure the optimized path.
Improve TopKQueue::iter perf + add list benchmark
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.

3 participants