LLO telemetry: drop old buffered seqNrs - #23558
LLO telemetry: drop old buffered seqNrs#23558denis-chernov-smartcontract wants to merge 1 commit into
Conversation
|
👋 denis-chernov-smartcontract, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
✅ No conflicts with other open PRs targeting |
|
I see you updated files related to
|
|
| // evictOldestSeqNrsLocked drops the oldest buffered seqNrs for digest until | ||
| // at most maxBufferedSeqNrsPerDigest remain. Callers must hold | ||
| // telemetryBufferMu. | ||
| func (t *telemeter) evictOldestSeqNrsLocked(digest string) { |
There was a problem hiding this comment.
Currently, these 2 for loops run in time O(N*N) where N = len(digestMessages), but this does not seem to be necessary. We want to drop smallest digestMessages seq, until we have maxBufferedSeqNrsPerDigest left. This can be done in O(N) time, you first find the maxBufferedSeqNrsPerDigest-smallest element, and then drop all the elements bigger than it.




Requires
Supports