Add rationale for passing values by reference

This commit is contained in:
Ayaz Hafiz 2023-06-16 17:51:13 -05:00
parent 0f327d9f38
commit 9ecb1bbd73
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -69,6 +69,9 @@ impl TargetInfo {
pub const fn max_by_value_size(&self) -> usize {
// Pass values larger than 4 machine words by reference.
// This is a reasonable default for most architectures. We want to pass large values by
// reference because it's more efficient than copying them around on the stack, and puts
// less pressure on CPU registers.
self.ptr_size() * 4
}