From 98b89e53e248e4b8cb6f4be042b9826a57d43e42 Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Sat, 10 Feb 2024 12:40:04 -0500 Subject: test(tvix/eval): Add test asserting size of Value Now that I've done a ton of things to make sure Value is small on the stack (16 bytes, which is a perfectly reasonable size for a programming language Value enum), add a test asserting it stays that way. These size improvements have a measurable impact, too - here's the `hello outpath` benchmark compared between canon (as of r/7495) and this commit: hello outpath time: [990.56 ms 995.83 ms 1.0070 s] change: [-7.1397% -6.1302% -5.1651%] (p = 0.00 < 0.05) Performance has improved. Change-Id: If99a0976eab28eb5e516fcd2f4a0e068145af23e Reviewed-on: https://cl.tvl.fyi/c/depot/+/10799 Reviewed-by: raitobezarius Tested-by: BuildkiteCI Autosubmit: aspen Reviewed-by: sterni --- tvix/eval/src/value/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tvix/eval/src') diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index efe2d09e33..165bdac597 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -1036,6 +1036,14 @@ fn type_error(expected: &'static str, actual: &Value) -> ErrorKind { #[cfg(test)] mod tests { + use super::*; + use std::mem::size_of; + + #[test] + fn size() { + assert_eq!(size_of::(), 16); + } + mod floats { use crate::value::total_fmt_float; -- cgit 1.4.1