Skip to content

perf: eliminate String clone during serialization#70

Merged
fabracht merged 3 commits intomainfrom
optimize-string-accessor
Dec 24, 2025
Merged

perf: eliminate String clone during serialization#70
fabracht merged 3 commits intomainfrom
optimize-string-accessor

Conversation

@fabracht
Copy link
Copy Markdown
Owner

Summary

  • Eliminate unnecessary heap allocation when serializing String fields
  • String fields now use references instead of cloning during try_to_be_bytes()
  • Remove unused is_copy function from utils.rs

Changes

  • Changed create_field_accessor semantics from needs_owned to is_copy parameter
  • Copy types (primitives, arrays) get value copy: let field = self.field;
  • Non-Copy types (String) get reference: let field = &self.field;
  • Removed 69-line is_copy function and 37 lines of related tests (dead code)

Breaking Changes

None - API unchanged, only internal optimization

Testing

  • All 280+ existing tests pass
  • macro_test binary runs successfully with String demos

@fabracht fabracht merged commit 6ff9c9c into main Dec 24, 2025
2 checks passed
@fabracht fabracht deleted the optimize-string-accessor branch December 24, 2025 21:26
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