Optimize log buffer slicing for live logs#6
Open
xxCodexIAxx wants to merge 2 commits into
Open
Conversation
|
@xxCodexIAxx is attempting to deploy a commit to the dragoon4002's projects Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
Vercel is currently blocked by repository authorization, not by a code/test failure in this PR. The status check reports: No code commit can resolve that authorization gate from the fork side. |
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.
Summary
Optimizes the live log buffer path used by
GET /logs.Instead of always converting the full in-memory deque to a list and then slicing,
get_logs(limit)now usesitertools.isliceto materialize only the requested tail window when the caller asks for fewer entries than the buffer contains.Why it is faster
The hot path for the frontend log stream usually needs the most recent entries, not the entire
_MAX_LOGSbuffer. This reduces temporary list allocation fromlen(_buffer)entries tolimitentries for bounded calls while preserving the existinglimit=0unlimited behavior.Validation
tests/test_log_buffer.pycovering tail ordering and existing unlimited behavior./logs, while bounded calls avoid the full-buffer copy.Bounty
Fixes #2
Payout wallet:
0x776CbBb63D81c08B4090DB503eAE7FDb8fBd7c6f