Skip to content

fix: cut down per request garbage#1202

Merged
ferhatelmas merged 1 commit into
masterfrom
ferhat/cut-down-garbage
Jul 6, 2026
Merged

fix: cut down per request garbage#1202
ferhatelmas merged 1 commit into
masterfrom
ferhat/cut-down-garbage

Conversation

@ferhatelmas

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Refactor

What is the current behavior?

Every request creates a new tenant location but it's immutable.
Renderer creates a every version and then discards all except one.

What is the new behavior?

Create a singleton tenant location and shared with all requests.
Use switch in renderer so that it only creates what it needs, nothing else.

Additional context

This reduces per request garbage.

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas requested a review from a team as a code owner July 6, 2026 07:56
Copilot AI review requested due to automatic review settings July 6, 2026 07:56

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.

Pull request overview

This PR reduces per-request garbage by reusing immutable objects and avoiding unnecessary renderer factory allocations in the Storage layer and HTTP storage plugin.

Changes:

  • Refactored Storage.renderer() to use a switch for lazy, single-renderer instantiation instead of constructing an object of factories per call.
  • Reused a singleton TenantLocation for non-iceberg requests to avoid per-request allocations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/storage/storage.ts Avoids per-call renderer factory object creation by switching to an exhaustive switch and assertNever.
src/http/plugins/storage.ts Reuses a singleton TenantLocation instead of allocating a new one for every non-iceberg request.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/http/plugins/storage.ts
@ferhatelmas ferhatelmas merged commit 0f7a505 into master Jul 6, 2026
25 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/cut-down-garbage branch July 6, 2026 08:01
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 28776554048

Coverage decreased (-0.002%) to 78.854%

Details

  • Coverage decreased (-0.002%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (6 of 8 lines covered, 75.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/storage/storage.ts 7 5 71.43%
Total (2 files) 8 6 75.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 12241
Covered Lines: 10095
Line Coverage: 82.47%
Relevant Branches: 7039
Covered Branches: 5108
Branch Coverage: 72.57%
Branches in Coverage %: Yes
Coverage Strength: 420.81 hits per line

💛 - Coveralls

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.

4 participants