Repository navigation
perf(listing): coalesce entry stream delivery - #5
Merged
Merged
Conversation
Replace per-flush entry pushes with a payload-free signal per subscriber and a drainEntries pull, so a busy JS thread queues at most one pending delivery and receives every entry appended since its last drain in one batch. - track a cursor and scheduled flag per EntryStream subscriber instead of pushing each batch - add drainEntries to SmbTask and NativeSmbListTask - drain once right after subscribing so late subscribers still get the replay - keep SmbListTask.subscribeEntries API, server order, and delivery before terminal status
Model the native cursor and deferred signals in FakeNativeListTask so coalescing, replay, and unsubscribe behavior stay covered without a device. - merge several appends behind one pending signal into a single batch - ignore signals that arrive after unsubscribe - drain the last entries before the terminal status settles
Describe how entry batches merge while the JS thread is busy and how batchSize and the 100ms delay now control native flushes rather than JS callbacks. - update subscribeEntries notes in API, task model, and architecture docs - clarify batch timing in the listDirectory JSDoc
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.
perf: coalesce entry stream delivery
Why
Large streaming listings flooded the JS thread: each native flush became one
subscribeEntriescallback (~600 × 10 for 6,000 files with SDs). Native work finished first; JS was still draining small batches afterTask completed.What
EntryStreamuses notify-and-drain: append wakes each subscriber at most once until it drains;drainEntriesreturns everything since the last drain.SmbListTask.subscribeEntriesAPI unchanged (replay, order, pre-terminal delivery).batchSize/ 100 ms still control native flushes only.Task completedwait()Design
Append stores entries and signals only if not already scheduled. JS drains
entries_[cursor..end]on each wake (and once on subscribe for replay). Busy JS coalesces several flushes into one batch; idle JS still sees ~batchSize.Notes for reviewers
subscribeEntries+drainEntries; public API unchanged.