Skip to content

perf: lazily construct ElectroError stack trace in formatResponse - #588

Merged
tywalch merged 1 commit into
tywalch:masterfrom
anatolzak:worktree-lazy-stack-trace
Aug 9, 2026
Merged

perf: lazily construct ElectroError stack trace in formatResponse#588
tywalch merged 1 commit into
tywalch:masterfrom
anatolzak:worktree-lazy-stack-trace

Conversation

@anatolzak

Copy link
Copy Markdown
Contributor

closes #587

@netlify

netlify Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploy Preview for electrodb-dev canceled.

Name Link
🔨 Latest commit 95f3cb3
🔍 Latest deploy log https://app.netlify.com/projects/electrodb-dev/deploys/6a782cc03ac16c0008dca298

@anatolzak
anatolzak force-pushed the worktree-lazy-stack-trace branch from 1c9841d to 95f3cb3 Compare August 9, 2026 07:31
@anatolzak

Copy link
Copy Markdown
Contributor Author

hey @tywalch! sorry for nudging you so much, quick follow-up to #586. while benchmarking that PR I noticed the formatter itself gets ~47x faster, but the full formatResponse path only landed ~10x, because formatResponse eagerly allocates a new ElectroError on every call, and once the JIT shrank the formatting work, it became ~80% of the remaining cost. this PR defers that allocation to the error path, which brings the whole path from ~10x up to ~41x

@tywalch
tywalch merged commit 0ceff20 into tywalch:master Aug 9, 2026
4 checks passed
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.

perf: lazily construct ElectroError stack trace in formatResponse (avoid allocation on happy path)

2 participants