Skip to content

Reduce async overhead in JS GraphBinary reads - #3630

Open
kirill-stepanishin wants to merge 1 commit into
apache:masterfrom
kirill-stepanishin:js-graphbinary-sync-read-fast-path
Open

Reduce async overhead in JS GraphBinary reads#3630
kirill-stepanishin wants to merge 1 commit into
apache:masterfrom
kirill-stepanishin:js-graphbinary-sync-read-fast-path

Conversation

@kirill-stepanishin

@kirill-stepanishin kirill-stepanishin commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Adds a synchronous fast path to gremlin-javascript StreamReader

Every primitive read in StreamReader awaits #ensure(n) first. For a buffered submit() response a chunk of
the payload is already in memory, so that await often does nothing but still costs a Promise and a
microtask per read, which dominates client CPU on large responses. Reads now return right away when the bytes are already buffered and only await when the buffer needs refilling.

Performance

Cross-region EC2 (server US-EAST-2, client US-WEST-2) over HTTP, Modern graph.

Workload Before After Change
g.V().repeat(both()).times(12) (~200k results) 2.714 s 2.085 s ~23% faster
g.V() (6 results) 0.054 s 0.056 s no change
g.V() throughput @ 64 / 256 / 1000 1226 / 2490 / 2396 req/s 1212 / 2633 / 2438 req/s no change

Assisted-by: Claude Code:claude-opus-4-8
@codecov-commenter

codecov-commenter commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.41%. Comparing base (a28cd1f) to head (fe0f4bd).
⚠️ Report is 544 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3630      +/-   ##
============================================
+ Coverage     76.35%   76.41%   +0.05%     
- Complexity    13424    14311     +887     
============================================
  Files          1012     1037      +25     
  Lines         60341    64670    +4329     
  Branches       7075     7675     +600     
============================================
+ Hits          46076    49420    +3344     
- Misses        11548    12175     +627     
- Partials       2717     3075     +358     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kenhuuu

kenhuuu commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

VOTE +1

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.

3 participants