Skip to content

Optimize log buffer slicing for live logs#6

Open
xxCodexIAxx wants to merge 2 commits into
Dragoon4002:mainfrom
xxCodexIAxx:bounty/log-buffer-slice-1782675766
Open

Optimize log buffer slicing for live logs#6
xxCodexIAxx wants to merge 2 commits into
Dragoon4002:mainfrom
xxCodexIAxx:bounty/log-buffer-slice-1782675766

Conversation

@xxCodexIAxx

Copy link
Copy Markdown

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 uses itertools.islice to 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_LOGS buffer. This reduces temporary list allocation from len(_buffer) entries to limit entries for bounded calls while preserving the existing limit=0 unlimited behavior.

Validation

  • Added tests/test_log_buffer.py covering tail ordering and existing unlimited behavior.
  • Static review: behavior is unchanged for default /logs, while bounded calls avoid the full-buffer copy.
  • Did not run the test suite locally in this constrained environment.

Bounty

Fixes #2

Payout wallet: 0x776CbBb63D81c08B4090DB503eAE7FDb8fBd7c6f

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@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.

@xxCodexIAxx

Copy link
Copy Markdown
Author

Vercel is currently blocked by repository authorization, not by a code/test failure in this PR.

The status check reports: Authorization required to deploy. The target URL points to Vercel Git authorization for this repository/team. Could a maintainer authorize the Vercel deployment for this PR so the deploy check can run?

No code commit can resolve that authorization gate from the fork side.

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.

Improvements Bounty: Performance Enhancer

1 participant