Repository navigation
perf(comments): join docs over a small socket pool in listComments - #60
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 14, 2026
aloth
added a commit
that referenced
this pull request
Oct 15, 2026
Speeds up the comment commands by fetching docs over a small socket pool (#60), stops the pool cleanly on failure, falls back to fewer sockets on HTTP 429, and adds --concurrency and OLCLI_CONCURRENCY.
Owner
|
Thanks, shipped in v0.14.0. On a 23-doc project Two follow-ups in the same release: a failed join now stops the pool and closes all sockets before the error is reported, and the pool size is configurable via |
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.
olcli comments listjoins every doc in the project one at a time (about 0.25 s each), so a 43-doc project takes around 14 s.resolve,reopenanddeletelook the thread up first, so they pay the same cost.Why not just join in parallel on the one socket
I tried. The socket is Socket.IO 0.9 over xhr-polling, and
socketRpchands the acknowledgment to whichever request polls first, so concurrent calls on a shared socket steal each other's acks. Five concurrentjoinDoccalls timed out after 7 s.Change
listCommentsnow spreads the docs over a small pool of sockets (up to 4), each pulling the next doc from a shared index. The parsing loop is unchanged. The diff looks bigger than it is because the oldtry/finallyis gone and the loop is de-indented;git diff -wis about 40 lines insrc/client.ts. CHANGELOG entry included.Numbers
One bench project (43 docs, 27 threads, 8 with replies, 3 resolved), median of 5 runs:
comments listcomments resolvecomments reopenThe "after" numbers are bimodal (about 2 s or about 5 s) and I don't know why; it looks like network or server variance. Output is identical before and after (same 27 threads).
Tests
npm testgoes from 87 to 88 passing. The new test stubsjoinDocument,openProjectSocketandcloseProjectSocketon a client instance (no network), and asserts 2 to 4 sockets are used, every socket is closed, and the comments come back right. It fails on the old code.What I haven't verified
history-otdoc path is untouched but untested against a live server (my docs are allsharejs-text-ot).CONTRIBUTING says to discuss bigger changes first. Happy to open an issue and move the discussion there if you'd rather.