Repository navigation
yes, portable.rs: change BUF_SIZE to 32 KiB - #16313
Conversation
oech3
commented
Nov 9, 2026
|
makes wasm sad: |
|
I can simpliy add cfg, but it is very odd. @eduardomourar |
801149f to
50a3535
Compare
| // it's possible that using a smaller or larger buffer might provide better performance | ||
| #[cfg(not(unix))] // small stack size? | ||
| pub(super) const BUF_SIZE: usize = 16 * 1024; | ||
| #[cfg(unix)] |
There was a problem hiding this comment.
portable.rs isn't used on linux (linux.rs is), so which OS gave these numbers? could you please share a benchmark on macos/freebsd?
There was a problem hiding this comment.
I tested this on Linux by removing cfg.
There was a problem hiding this comment.
So, are these numbers representative of actual performance on any supported platform?
There was a problem hiding this comment.
$ wasmtime '/tmp/dec/coreutils-wasm32-wasip1/16-yes.wasm'|pv>/dev/null
[2.66~2.70GiB/s]
$ wasmtime '/tmp/dec/coreutils-wasm32-wasip1/32-yes.wasm'|pv>/dev/null
[2.74~2.98GiB/s]
|
I have confirmed that it is not caused by your changes. My guess is that it is an issue in wasmtime itself (or limitation of the resources/infra of GitHub Actions). I cannot get the actual host/guess error as it is never surfaced in the logs, though. Just for reference, I have raised this issue to track it: #16314. |
|
Thankyou. Actually, it was caused by #16313 (comment) . |
|
To be honest, I'd rather default to a 8 KiB buffer size for the portable implementation, then raise it per platform as appropriate. |
|
I don't agree. |
|
Rust standard library |
|
Getting L2 cache size might interesting. But it needs additional syscall. |
|
What about using a stack-allocated buffer (for non-Linux)? |
|
I want to do that. But size of input is not frozen. We need |
Issue opened: #16380. |