Repository navigation
Use deque instead of slice for queues - #742
Merged
Merged
Conversation
Implementing a queue by appending to a slice will make more GC work as then end of slice's memory is reached. Instead use a deque that maintains a circular buffer that reuses memory from removed items.
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #742 +/- ##
==========================================
+ Coverage 60.38% 60.40% +0.01%
==========================================
Files 245 245
Lines 31069 31063 -6
==========================================
+ Hits 18762 18763 +1
+ Misses 10635 10628 -7
Partials 1672 1672
|
gammazero
marked this pull request as ready for review
December 6, 2024 05:11
gammazero
force-pushed
the
use-deque-for-queue
branch
from
December 6, 2024 20:21
07bb8ab to
fe91a64
Compare
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.
Implementing a queue by appending to a slice will makes more GC work as the end of slice's memory is reached. Instead use a deque that maintains a circular buffer that reuses memory from removed items.
Fixed a case where a new timer was created during each iteration of a loop, instead of reusing a timer.