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 <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Aspen Smith 2024-02-10 12:40:04 -05:00 committed by clbot
parent 7e286aab1a
commit 98b89e53e2

View file

@ -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::<Value>(), 16);
}
mod floats {
use crate::value::total_fmt_float;