Skip to content

chore: Add script to show the sizes of futures (async Rust) - #8536

Open
Hocuri wants to merge 3 commits into
mainfrom
hoc/add-future-sizes-script
Open

chore: Add script to show the sizes of futures (async Rust)#8536
Hocuri wants to merge 3 commits into
mainfrom
hoc/add-future-sizes-script

Conversation

@Hocuri

@Hocuri Hocuri commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Add the script from https://github.com/chatmail/core/pull/8345/changes#r3696015000 with a few small tweaks

@Hocuri
Hocuri requested a review from link2xt August 3, 2026 11:00
@Hocuri
Hocuri force-pushed the hoc/add-future-sizes-script branch from d07cd6d to d6f3c82 Compare August 3, 2026 11:03
@link2xt

link2xt commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

I pinned one of the largest futures, this helps: #8537

There is however still a pgp message decryptor that is huge (tens of kbtes), is returned from decrypt and increases the size of all imap fetch functions:

print-type-size type: `pgp::composed::Message<'_>`: 4544 bytes, alignment: 16 bytes
print-type-size     variant `Encrypted`: 4537 bytes
print-type-size         field `.edata`: 4512 bytes
print-type-size         field `.esk`: 24 bytes
print-type-size         field `.is_nested`: 1 bytes
print-type-size     variant `Compressed`: 217 bytes
print-type-size         padding: 16 bytes
print-type-size         field `.reader`: 200 bytes, alignment: 8 bytes
print-type-size         field `.is_nested`: 1 bytes
print-type-size     variant `Literal`: 193 bytes
print-type-size         padding: 16 bytes
print-type-size         field `.reader`: 176 bytes, alignment: 8 bytes
print-type-size         field `.is_nested`: 1 bytes
print-type-size     variant `Signed`: 105 bytes
print-type-size         padding: 16 bytes
print-type-size         field `.reader`: 88 bytes, alignment: 8 bytes
print-type-size         field `.is_nested`: 1 bytes
print-type-size     end padding: 7 bytes

This should be boxed, maybe even inside of pgp. pgp has #[allow(clippy::large_enum_variant)] in multiple places, and this is why it is a problem, these variants should be boxed. We can box the whole message as a workaround.

@link2xt

link2xt commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

The lint is currently disabled, we can reenable it back if the problem is fixed: #8487

@link2xt

link2xt commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

For reference: https://nnethercote.github.io/perf-book/type-sizes.html
If we shrink down receive_imf size, can also add a test to make sure its size is below some reasonable size.

Comment thread scripts/future-sizes.sh Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants