Skip to content

fix: 优化 getBytes 方法使用 memcpy 替代循环拷贝#7

Merged
CPythoner merged 1 commit intomasterfrom
issue-3-optimization-getBytes
Apr 3, 2026
Merged

fix: 优化 getBytes 方法使用 memcpy 替代循环拷贝#7
CPythoner merged 1 commit intomasterfrom
issue-3-optimization-getBytes

Conversation

@CPythoner
Copy link
Copy Markdown
Owner

描述

本 PR 修复了 Issue #3,将 getBytes 方法的内部实现从循环拷贝改为使用 memcpy。

变更内容

  • 使用 memcpy 替代字节循环拷贝,提升性能
  • 保留合法性检测逻辑
  • 代码更简洁

性能提升

使用 memcpy 替代循环拷贝可以带来显著的性能提升:

  • memcpy 是底层优化的内存拷贝函数
  • 避免了循环开销和逐字节操作
  • 可能利用 SIMD 指令进行批量拷贝

相关链接

- 使用 memcpy 替代字节循环拷贝,提升性能
- 保留合法性检测逻辑
- 修复 Issue #3
@CPythoner CPythoner force-pushed the issue-3-optimization-getBytes branch from 8de0572 to fbccf0c Compare April 3, 2026 15:43
@CPythoner CPythoner merged commit 0ffc21e into master Apr 3, 2026
6 checks passed
@CPythoner CPythoner deleted the issue-3-optimization-getBytes branch April 4, 2026 08:39
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.

getBytes 内部建议用 memcpy_s 实现

1 participant