Skip to content

perf: reduce client interceptor async layers - #197

Merged
SunSi12138 merged 4 commits into
devfrom
feature/issue-195-client-interceptor-fast-path
Aug 14, 2026
Merged

perf: reduce client interceptor async layers#197
SunSi12138 merged 4 commits into
devfrom
feature/issue-195-client-interceptor-fast-path

Conversation

@SunSi12138

Copy link
Copy Markdown
Owner

来源

#195(Client interceptor non-async fast path)。

改动

  • 合并 Client interceptor 链的 async 层:
    • 终端层:InvokeTerminalTrackedAsync 改为非 async 委托,status/error/elapsed 下沉到各 shape 的 InvokeTerminalAsync,通过共享 MarkTerminalSucceeded/Failed/Elapsed helper。
    • 外层:InvokeAsync 改为非 async 委托到 RunChainAsync,新增 RunTypedChainAsync<TResult> 供 unary/client-streaming 直接返回 typed result,避免 InvokeTypedAsync 的额外 async 层。

验证(242 CPU5,各 5 轮)

scenario baseline B/op candidate B/op CPU
FixedDefault 950-951 951 25.97-28.00µs(无回退)
ClientInterceptor 1873-1875 1610-1613 28.25-30.65µs
ClientInterceptor2 1706-1708
ClientInterceptor8 2280-2283
  • 1 层附加成本 -262 B(约 28.4%),达到 >=25% 门槛。
  • feature-off 零回退;每加一层仍 +96 B。
  • 928 单元测试 + 22 InterceptorIntegrationTests 通过。

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 7d8615037c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SunSi12138

Copy link
Copy Markdown
Owner Author

@codex review

补充了共享 outcome helper 重构(把 RunChainAsync / RunTypedChainAsync 的 status/error/elapsed 分类抽成 MarkChainSucceeded / MarkTerminalFailed / MarkTerminalElapsed,消除重复)。请评审最新提交。

注:CI 上一轮的 quick 集成测试失败是 GracefulStopShouldDrainOneHundredAcceptedCallsAndReleaseResources(非 interceptor 的 graceful-stop 用例),本地连跑 3 次均通过,属 flaky;已 rerun CI。

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 0a98b1724a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SunSi12138
SunSi12138 merged commit 64d3e21 into dev Aug 14, 2026
3 of 4 checks passed
@SunSi12138
SunSi12138 deleted the feature/issue-195-client-interceptor-fast-path branch August 14, 2026 05:18
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.

1 participant