Changes advance to advance on time to support large intervals - #8
Open
TimEvens wants to merge 2 commits into
Open
Changes advance to advance on time to support large intervals#8TimEvens wants to merge 2 commits into
TimEvens wants to merge 2 commits into
Conversation
suhasHere
reviewed
Jun 13, 2026
| FORCE_INLINE void clear() noexcept | ||
| { | ||
| if (_queue.empty()) { | ||
| return; |
GhostofCookie
requested changes
Jun 15, 2026
| for (std::size_t i = 0; i < intervals_elapsed; ++i) { | ||
| bucket_type& bucket = _buckets[get_future_bucket_index(i)]; | ||
| bucket.clear(); | ||
| bucket.shrink_to_fit(); |
Collaborator
There was a problem hiding this comment.
This is needed to reclaim space in the bucket, otherwise we retain the allocated space.
GhostofCookie
requested changes
Jun 15, 2026
| [[nodiscard]] FORCE_INLINE constexpr index_type bucket_count() const noexcept | ||
| { | ||
| // The spare bucket prevents max-duration TTLs pushed mid-interval from being cleared early. | ||
| return (_duration / _interval) + 1; |
Collaborator
There was a problem hiding this comment.
That could also potentially crash since now you could in theory get a future bucket index that is == to the size of the vector, which would be a bad access.
Collaborator
There was a problem hiding this comment.
Ah, but buckets are a map. Right. Hmm... still not sure about this.
| } | ||
|
|
||
| if (delta >= _duration) { | ||
| const auto intervals_elapsed = delta / _interval; |
Collaborator
There was a problem hiding this comment.
Suggested change
| const auto intervals_elapsed = delta / _interval; | |
| const auto buckets_elapsed = delta / _interval; |
* MAke another version of the timequeue that doesn't use buckets. * Change to fast_time_queue. * Improve benchmarks. * Remove queue clear duration division by 5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.