[0023] 优化 utf8-string-set! 性能#787
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
utf8-string-set!从string->utf8+bytevector-copy+bytevector-append+utf8->string改为更高效的实现make-bytevector+ 手动循环填充,减少临时对象关键改动
string->byte-vector替代string->utf8— 消除 UTF-8 验证循环和多余复制byte-vector->string替代utf8->string— 消除 UTF-8 验证循环make-bytevector+ 手动循环(比copy+append减少临时对象)性能对比
Test plan
bin/gf tests/liii/unicode/utf8-string-set-bang-test.scm— 21 项测试全部通过bin/gf tests/liii/unicode/— 全部 25 个 unicode 测试通过,零回归bin/gf bench/utf8-string-set-bang.scm— 基准测试验证性能提升🤖 Generated with Claude Code