Skip to content

[Enhancement] Implement FastCodesHeader encode/decode for SendMessageRequestHeader/ResponseHeader #10533

Description

@wang-jiahua

Before Creating the Enhancement Request

  • I have confirmed that this should be classified as an enhancement rather than a bug/feature.

Summary

Implement FastCodesHeader.encode()/decode() for SendMessageRequestHeader and SendMessageResponseHeader to eliminate reflection-based header serialization.

Motivation

SendMessageRequestHeader does not implement FastCodesHeader, so every send message request goes through makeCustomHeaderToNet() which uses reflection to serialize header fields into extFields. This creates per-RPC allocation (HashMap entries, String values from toString()) and CPU overhead from reflective field access.

With R1 (#10522) merged, the FastCodesHeader interface now provides writeLong/writeInt helpers that can write numeric fields directly without String.valueOf() allocation. Implementing encode()/decode() on send message headers eliminates the reflection path entirely.

Describe the Solution You'd Like

Implement encode() and decode() methods on:

  • SendMessageRequestHeader — 14 fields including Long/Integer types
  • SendMessageResponseHeader — 5 fields
  • SendMessageRequestHeaderV2 — fix decode() signature to match interface

Additional Context

Depends on R1 (#10522, merged). Related PRs: #10443, #10514, #10526.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions