Skip to content

Runner: avoid data copy#193

Open
helloopenworld wants to merge 1 commit into
mainfrom
features/dev_opt
Open

Runner: avoid data copy#193
helloopenworld wants to merge 1 commit into
mainfrom
features/dev_opt

Conversation

@helloopenworld

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@helloopenworld

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Rook1ex added a commit to trpc-group/cla-database that referenced this pull request Jul 16, 2026
@CongkeChen

Copy link
Copy Markdown
Contributor

AI Code Review

这个 diff 是一个简洁且正确的优化。list.append + "".join 的语义与原来的 str += 累加完全相同(if part.text: 的真值检查保留了相同的行为,clear() 对应重置操作,在取消时的 join 操作也产生了相同的字符串)。未发现任何阻碍性问题。

发现的问题

未发现明显阻塞问题。

总结

本次变更将取消时用于累计 partial 文本的字符串拼接(temp_text += part.text)改为列表追加 + 取消时一次性 "".join,是一个纯粹的字符串累积优化。if part.text: 的真值判断、clear() 重置以及最终 join 的语义与原实现完全等价,正确性与原有行为一致,不存在功能性风险。

测试建议

暂无额外测试建议。该路径(取消时 partial 文本累计)若已有覆盖则行为不变;若未来需补测,建议覆盖流式过程中途取消时 temp_text 包含已累积的 partial 片段的场景。

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.

2 participants