Skip to content

Commit

Permalink
Use one weird trick to reduce the size of your crate by 100+ MB
Browse files Browse the repository at this point in the history
No, seriously.

For reasons I have not been able to pin down, it seems like
include_str is treated differently from include_bytes. This change
reduces the sizes of the binaries libwycheproof.rlib and
libwycheproof.rmeta from 150M/69M to 88M/7.2M
  • Loading branch information
randombit committed Aug 27, 2024
1 parent d2814b7 commit e79c9d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ macro_rules! define_test_set_names {
pub fn json_data(&self) -> &'static str {
match self {
$(
Self::$enum_name => include_str!(concat!("data/", $test_name, "_test.json")),
Self::$enum_name => std::str::from_utf8(include_bytes!(concat!("data/", $test_name, "_test.json"))).expect("Invalid UTF8"),
)*
}
}
Expand Down

0 comments on commit e79c9d8

Please sign in to comment.