Stream: git-wasmtime

Topic: wasmtime / PR #4951 Shrink all SmallVecs by 8 bytes


view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2022 at 21:38):

jameysharp requested cfallin for a review on PR #4951.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2022 at 21:38):

jameysharp opened PR #4951 from shrink-abiarg to main:

We weren't using the "union" cargo feature for the smallvec crate, which reduces the size of a SmallVec by one machine word. This feature requires Rust 1.49 but we already require much newer versions.

I also reduced ABIArgSlot::Stack::offset from i64 to i32, so it fits in the same space as ABIArgSlot::Reg::reg. This eliminates all padding from ABIArgSlot, saving 8 bytes there. Without that change, ABIArg wouldn't shrink even though it contains a SmallVec.

When using Wasmtime to compile pulldown-cmark from Sightglass, this saves a decent amount of memory allocations and writes. According to valgrind --tool=dhat:

Reducing the size of SmallVecs also shrinks other types by varying amounts. Here are some types that shrink by quite a bit but aren't allocated often:

Here are some types which don't shrink by a lot, but are allocated very often:

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2022 at 21:38):

jameysharp requested fitzgen for a review on PR #4951.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2022 at 21:40):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2022 at 22:49):

jameysharp updated PR #4951 from shrink-abiarg to main.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 23 2022 at 23:32):

jameysharp merged PR #4951.


Last updated: Nov 22 2024 at 16:03 UTC