Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the size of the MessageID structs by one word on 64-bit arch #316

Merged
merged 1 commit into from
Jul 8, 2020

Commits on Jul 8, 2020

  1. Reduce the size of the MessageID structs by one word on 64-bit arch

    An int occupies one word of memory; on 64-bit machines, this is 8 bytes.
    
    As a result, the messageID struct is 56-bytes:
    * ledgerID - 8 bytes
    * entryID - 8 bytes
    * batchIdx - 8 bytes
    * partitionIdx - 8 bytes
    * tracker - 8 bytes
    * consumer - 16 bytes (1 word for type, 1 word for data address)
    
    This commit changes the type of batchIdx and partitionIdx fields to int32
    which saves one word of memory and maintains alignment of struct fields.
    
    Reducing the size of the MessageID structs is important as they are
    currently allocated on the heap for every message produced or consumed.
    
    Signed-off-by: Daniel Ferstay <dferstay@splunk.com>
    Daniel Ferstay committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    045b83b View commit details
    Browse the repository at this point in the history