apple / swift-nio-imap

A Swift project that provides an implementation of the IMAP4rev1 protocol, built upon SwiftNIO.
Apache License 2.0
101 stars 14 forks source link

Reduce size of MailboxName and MailboxPath #755

Closed danieleggert closed 6 months ago

danieleggert commented 6 months ago

Reduce MemoryLayout<MailboxPath>.size and MemoryLayout<MailboxName>.size.

Motivation:

Some users have a lot of mailboxes, and reducing the size of these helps.

Modifications:

  1. MailboxName: Instead of storing hashValue: Int (8 bytes on 64 bit), store _hashValue: UInt32 (4 bytes).
  2. MailboxPath: Instead of storing pathSeparator: Character? (16 bytes on 64 bit), store _pathSeparator: UInt8 (1 bytes).

Result:

The size of MailboxPath drops from 32 bytes to 13 bytes (on 64 bit).

Davidde94 commented 6 months ago

Nice!