Skip to content

Conversation

@ReagentX
Copy link
Owner

  • Performance boost
    • Remove unnecessary alloc in read_types()
    • Inline some hot functions
    • Use faster data structure for seen_embedded_types cache

@ReagentX ReagentX self-assigned this Jun 25, 2025
@ReagentX ReagentX requested a review from Copilot June 25, 2025 15:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes TypedStreamDeserializer by removing redundant allocations, inlining hot functions, and replacing the HashSet cache with a Vec for tracking embedded types.

  • Swapped seen_embedded_types: HashSet<usize> for a Vec<usize>
  • Added #[inline(always)] to several small readers
  • Refactored read_number and read_types to avoid cloning and reduce indirection

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/deserializer/typedstream.rs Replaced HashSet with Vec, inlined methods, and refactored number/type readers
src/deserializer/read.rs Added #[inline(always)] to byte- and pointer-readers
Comments suppressed due to low confidence (1)

src/deserializer/typedstream.rs:161

  • The comment on read_unsigned_int incorrectly says "signed integer"; it should reference "unsigned integer" to match the function's purpose.
    /// Reads a signed integer from the stream, advancing the position.

@ReagentX ReagentX merged commit 9c3e3c5 into develop Jun 25, 2025
1 check passed
@ReagentX ReagentX deleted the feat/cs/remove-alloc branch June 25, 2025 15:35
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