Skip to content

[Fusion] Reuse contiguous source response segments - #10582

Merged
tobias-tengler merged 1 commit into
mainfrom
tte/reuse-contiguous-response-segments
Oct 17, 2026
Merged

tobias-tengler merged 1 commit into
mainfrom
tte/reuse-contiguous-response-segments

Conversation

@tobias-tengler

@tobias-tengler tobias-tengler commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

When a source response spans arena chunks that occupy adjacent ranges of the same byte array, Fusion still builds a linked sequence for the JSON reader. This allocates temporary sequence nodes and makes the reader process segmented input even though the bytes are contiguous.

This change recognizes the same backing array and exact adjacent offsets, then reads that range as one contiguous sequence. The original chunk table, packed data coordinates and document ownership stay intact. Gapped ranges and separate arrays use the existing linked sequence after the adjacency check.

Method Version Mean Ratio Allocated Alloc Ratio
Known length, 128 B main 838.737 ns 1.00 1192 B 1.00
Known length, 128 B PR 825.232 ns 0.98 1192 B 1.00
Unknown length, 4 KiB main 1027.061 ns 1.00 1282 B 1.00
Unknown length, 4 KiB PR 967.155 ns 0.94 1137.5 B 0.89
Unknown length, 32 KiB main 3407.502 ns 1.00 1426 B 1.00
Unknown length, 32 KiB PR 3130.398 ns 0.92 1139 B 0.80

@github-actions

Copy link
Copy Markdown
Contributor

Patch coverage

100.0% of changed lines covered (16/16)

File Covered Changed Patch %
…/src/Fusion.Execution/Text/Json/SourceResultDocument.Parse.cs 16 16 100.0% 🟢

Project coverage: 59.0% (311341/527669 lines)

@tobias-tengler
tobias-tengler marked this pull request as ready for review October 17, 2026 20:00
Copilot AI balanced review requested due to automatic review settings October 17, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants