EthanBlackburn opened PR #11979 from EthanBlackburn:component-types-contention to bytecodealliance:main:
PR to resolve performance issue discovered in https://github.com/bytecodealliance/wasmtime/issues/11974
This caches the component types to prevent inc/dec contention on
arc::clone
EthanBlackburn requested alexcrichton for a review on PR #11979.
EthanBlackburn requested wasmtime-core-reviewers for a review on PR #11979.
EthanBlackburn edited PR #11979:
PR to resolve performance issue discovered in https://github.com/bytecodealliance/wasmtime/issues/11974
This caches the component types to prevent inc/dec contention on
arc::clone.Not sure how you'd want to do this, but happy to go through several iterations or let Alex handle it.
EthanBlackburn edited PR #11979:
PR to resolve performance issue discovered in https://github.com/bytecodealliance/wasmtime/issues/11974
This caches the component types to prevent inc/dec contention on
arc::clone.From our own benchmarks:
Before change
producer bytes (consumed): 2798.62 MiB → 93.28 MiB/s guest: bytes_in=2794.94 MiB, avg_latency=19.490 ms (over 12169 calls)After change
producer bytes (consumed): 3731.03 MiB → 124.36 MiB/s guest: bytes_in=3728.28 MiB, avg_latency=13.473 ms (over 16252 calls)Not sure how you'd want to do this, but happy to go through several iterations or let Alex handle it.
EthanBlackburn edited PR #11979:
PR to resolve performance issue discovered in https://github.com/bytecodealliance/wasmtime/issues/11974
This caches the component types to prevent inc/dec contention on
arc::clone.From our own benchmarks:
Before change
producer bytes (consumed): 2798.62 MiB → 93.28 MiB/s guest: bytes_in=2794.94 MiB, avg_latency=19.490 ms (over 12169 calls)After change
producer bytes (consumed): 3731.03 MiB → 124.36 MiB/s guest: bytes_in=3728.28 MiB, avg_latency=13.473 ms (over 16252 calls)I'm not sure if my approach is the right one, but happy to go through several iterations or let Alex handle it.
alexcrichton submitted PR review:
Thanks for the PR! This is something though where I'd prefer to not add extra unsafe abstractions if we can. I haven't studied this too too much yet but I'll try to spend some time in the near future looking at the call graphs here and see if I can't figure out a way to plumb a borrow around that'd help out
EthanBlackburn closed without merge PR #11979.
EthanBlackburn commented on PR #11979:
Makes sense. I took a look at plumbing a borrow, but seems like I'd have to change several layers in the callstack I'm not familiar with, and my change would require several review turnarounds. Will leave it to you
Thanks again
EthanBlackburn edited a comment on PR #11979:
Makes sense. I took a look at plumbing a borrow, but seems like I'd have to change several layers in the callstack I'm not familiar with, and my change would require several review turnarounds. Will leave it to you
Thanks again for taking a look!
Last updated: Dec 06 2025 at 06:05 UTC