Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: msgpack/msgpack-ruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: msgpack/msgpack-ruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fast-structs
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 8 commits
  • 12 files changed
  • 2 contributors

Commits on Dec 10, 2025

  1. Add optimized_struct option for fast Struct serialization

    Adds a C-level fast path for serializing and deserializing Ruby Struct
    types, bypassing Ruby proc callbacks entirely.
    
    Usage:
      factory.register_type(0x01, MyStruct, optimized_struct: true)
    
    Benefits:
    - Directly accesses struct fields via RSTRUCT_GET in C
    - No Ruby method calls for field access
    - No proc allocation or invocation overhead
    - Supports both regular and keyword_init structs
    
    The wire format is identical to the recursive proc-based approach,
    ensuring compatibility with existing serialized data.
    
    This provides significant performance improvements for applications
    that serialize many Struct objects.
    gmalette committed Dec 10, 2025
    Configuration menu
    Copy the full SHA
    9312864 View commit details
    Browse the repository at this point in the history

Commits on Dec 11, 2025

  1. Add benchmark

    gmalette committed Dec 11, 2025
    Configuration menu
    Copy the full SHA
    519b457 View commit details
    Browse the repository at this point in the history
  2. Add ref_tracking option for object deduplication during serialization

    When registering an extension type with ref_tracking: true, repeated
    objects are serialized as back-references instead of being re-encoded.
    This reduces payload size when the same object appears multiple times.
    
    Uses ext type 127 with a compact wire format:
    - New reference: nil marker followed by the serialized object
    - Back-reference: positive integer ref_id pointing to earlier object
    gmalette committed Dec 11, 2025
    Configuration menu
    Copy the full SHA
    3581be2 View commit details
    Browse the repository at this point in the history
  3. Edit benchmark

    gmalette committed Dec 11, 2025
    Configuration menu
    Copy the full SHA
    17927ff View commit details
    Browse the repository at this point in the history
  4. Use posargs

    gmalette committed Dec 11, 2025
    Configuration menu
    Copy the full SHA
    40af3f3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1c81f0a View commit details
    Browse the repository at this point in the history
  6. Implement positional struct packing and unpacking

    Very sligthly slower than naive positional, but work with
    both positional and keyword structs.
    byroot committed Dec 11, 2025
    Configuration menu
    Copy the full SHA
    ed72e7f View commit details
    Browse the repository at this point in the history
  7. Reuse the unpackers and freeze the payload

    Saves a few allocations. Mostly helps on smaller
    payloads, as the cost of building the unpacker is quite high.
    byroot committed Dec 11, 2025
    Configuration menu
    Copy the full SHA
    edff910 View commit details
    Browse the repository at this point in the history
Loading