]> Sergey Matveev's repositories - public-inbox.git/commit
imap: introduce memory-efficient uo2m mapping
authorEric Wong <e@yhbt.net>
Fri, 12 Jun 2020 23:49:24 +0000 (23:49 +0000)
committerEric Wong <e@yhbt.net>
Sat, 13 Jun 2020 07:55:45 +0000 (07:55 +0000)
commit3d52c093ad5ce7a32f8842d9ae020712f9786352
treef375b25be12526cbbae99e8748cb0738e83a0eed
parentc5fb8d66dfc1fa7034c6e7350bc6474cdde6b6a7
imap: introduce memory-efficient uo2m mapping

Since we limit our mailboxes slices to 50K and can guarantee a
contiguous UID space for those mailboxes, we can store a mapping
of "UID offsets" (not full UIDs) to Message Sequence Numbers as
an array of 16-bit unsigned integers in a 100K scalar.

For UID-only FETCH responses, we can momentarily unpack the
compact 100K representation to a ~1.6M Perl array of IV/UV
elements for a slight speedup.

Furthermore, we can (ab)use hash key deduplication in Perl5 to
deduplicate this 100K scalar across all clients with the same
mailbox slice open.

Technically we can increase our slice size to 64K w/o increasing
our storage overhead, but I suspect humans are more accustomed
to slices easily divisible by 10.
MANIFEST
lib/PublicInbox/IMAP.pm
t/imap.t
xt/mem-imapd-tls.t [new file with mode: 0644]