scovich commented on code in PR #7888: URL: https://github.com/apache/arrow-rs/pull/7888#discussion_r2198302996
########## parquet-variant/src/variant.rs: ########## @@ -256,6 +256,9 @@ pub enum Variant<'m, 'v> { List(VariantList<'m, 'v>), } +// We don't want this to grow because it could hurt performance of a frequently-created type. +const _: () = crate::utils::expect_size_of::<Variant>(80); Review Comment: New addition -- I encapsulated the size check into a const helper function, whose compilation failure includes the object's actual size (otherwise, have to guess what the size was): ``` error[E0080]: evaluation of constant value failed --> parquet-variant/src/utils.rs:139:17 | 139 | let _ = ["";0][size]; | ^^^^^^^^^^^^ index out of bounds: the length is 0 but the index is 80 | note: inside `utils::expect_size_of::<variant::Variant<'_, '_>>` --> parquet-variant/src/utils.rs:139:17 | 139 | let _ = ["";0][size]; | ^^^^^^^^^^^^ note: inside `variant::_` --> parquet-variant/src/variant.rs:260:15 | 260 | const _: () = crate::utils::expect_size_of::<Variant>(64); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` As can be seen, a check for `Variant` itself exposes the fact that it's 80 bytes. I can't figure out why -- `VariantObject` and `VariantList` are the only big enum variants (the next-biggest is 32 bytes)?? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org