fitzgen opened PR #13312 from fitzgen:wasmtime-array-copy-non-gc-ref to bytecodealliance:main:
Addresses a long-standing
TODOcomment whose performance implications were also observed in https://github.com/bytecodealliance/wasmtime/issues/13279(Still investigating the panic that issue's benchmarks trigger in the copying collector, however.)
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen requested wasmtime-compiler-reviewers for a review on PR #13312.
fitzgen requested wasmtime-core-reviewers for a review on PR #13312.
fitzgen requested alexcrichton for a review on PR #13312.
:memo: alexcrichton submitted PR review:
Could you add a test as well that takes ~little time with this PR but maybe ~many seconds without this PR? Out of curiosity, how much does this help https://github.com/bytecodealliance/wasmtime/issues/13279?
Also, as a separate question, would it make sense to delete one or both of these libcalls eventually? For example with GC arrays I figure it'd be best to just do the loop in Cranelift, and for non-GC arrays I figure it might be best to have a single
memcpylibcall that's pretty raw and that way we could funnelmemory.copythrough there too. That way we could const-propagate a lot of things here like thechecked_muland array offsets and such which might be a noticable boost.
:speech_balloon: alexcrichton created PR review comment:
Were we to run this through miri I think it would flag this as a violation as
data.slice_mutI believe invalidates the previoussrc_ptrderived. Would it be possible to usecopy_withinhere?
:thumbs_up: alexcrichton submitted PR review.
github-actions[bot] added the label wasmtime:api on PR #13312.
fitzgen commented on PR #13312:
Could you add a test as well that takes ~little time with this PR but maybe ~many seconds without this PR? Out of curiosity, how much does this help #13279?
That benchmark still takes 45 minutes to complete for me locally. Something strange is going on, but I haven't looked in any further.
Therefore, I'll hold off on adding a test that takes ~little time now but ~lots of time before, because I don't think we are done here.
Also, as a separate question, would it make sense to delete one or both of these libcalls eventually? For example with GC arrays I figure it'd be best to just do the loop in Cranelift, and for non-GC arrays I figure it might be best to have a single
memcpylibcall that's pretty raw and that way we could funnelmemory.copythrough there too. That way we could const-propagate a lot of things here like thechecked_muland array offsets and such which might be a noticable boost.That makes sense, I can look into this sometime soon ish. Want to do some benchmarking, as mentioned above, to understand more about what's going on here tho.
fitzgen updated PR #13312.
fitzgen has enabled auto merge for PR #13312.
fitzgen updated PR #13312.
fitzgen added PR #13312 Add separate libcalls for array.copy w/ vs. w/out GC ref elems to the merge queue.
:check: fitzgen merged PR #13312.
fitzgen removed PR #13312 Add separate libcalls for array.copy w/ vs. w/out GC ref elems from the merge queue.
Last updated: Jun 01 2026 at 09:49 UTC