Skip to content

Eliminate polling latency in BinaryView search generators. - #8465

Open
bpotchik wants to merge 1 commit into
devfrom
fix_python_queuegenerator
Open

Eliminate polling latency in BinaryView search generators.#8465
bpotchik wants to merge 1 commit into
devfrom
fix_python_queuegenerator

Conversation

@bpotchik

Copy link
Copy Markdown
Member

Remove 100ms polling latency from BinaryView search QueueGenerator

@bpotchik
bpotchik requested a review from psifertex August 25, 2026 13:12
@bpotchik bpotchik self-assigned this Aug 25, 2026
@psifertex

Copy link
Copy Markdown
Member

claude ID'd a hang if you call next() after emptying the search results. I don't think it's super likely to trigger in practice with well-formed code but it is technically possible now and wasn't before.

┌───────────────────────────────────────────────┬─────────┬────────────┐
│                                               │ with PR │  without   │
├───────────────────────────────────────────────┼─────────┼────────────┤
│ for a, d in bv.search(...) (hit and miss)     │ ok      │ ok         │
├───────────────────────────────────────────────┼─────────┼────────────┤
│ list() / sorted() / any() / zip()             │ ok      │ ok         │
├───────────────────────────────────────────────┼─────────┼────────────┤
│ next(iter(...), None)                         │ ok      │ ok         │
├───────────────────────────────────────────────┼─────────┼────────────┤
│ for ...: break (never exhausted)              │ ok      │ ok         │
├───────────────────────────────────────────────┼─────────┼────────────┤
│ limit=1, take one, then list(g) for leftovers │ ok      │ ok         │
├───────────────────────────────────────────────┼─────────┼────────────┤
│ two for loops over the same generator         │ HANG    │ ok, 210 ms │
├───────────────────────────────────────────────┼─────────┼────────────┤
│ for loop, then a defensive next(g, None)      │ HANG    │ ok, 206 ms │
├───────────────────────────────────────────────┼─────────┼────────────┤
│ two threads draining one generator            │ HANG    │ ok, 105 ms │
└───────────────────────────────────────────────┴─────────┴────────────┘

It does fix the performance issue I was running into!

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.

2 participants