Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move feature descriptions out of std.Target.Cpu.Feature
This allows users of std.Target to not include all the description strings in their program if they don't actually use them. Counting all the bytes of the description strings after they were separated out using this code: comptime { @setEvalBranchQuota(10000000); var total_byte_count: usize = 0; for (std.enums.values(Arch)) |arch| { const descs = allFeaturesDescList(arch); for (descs) |desc| { total_byte_count += desc.len; } } @compilelog(total_byte_count); } gives a total size of 146898 bytes or ~143 KiB. However, I have not seen quite that much saved in compiled binaries in practice. A test program like this: const std = @import("std"); pub fn main() !void { const target = try std.zig.system.resolveTargetQuery(.{}); std.debug.print("{any}\n", .{target}); } compiled in ReleaseSmall on Windows gives these results: - Before: 321024 bytes (313.5 KiB) - After: 219648 bytes (214.5 KiB) - Delta: 101376 bytes ( 99.0 KiB) Note: The spirv features were not intended to be changed, but I'm not sure what exact versions of the Headers/Registry were used to generate the current `Target/spirv.zig`. I used commits around the time of the last `Target/spirv.zig` update in May 2021 (98dc8eb); in particular, I used commits 60af2c93c46294a2bc9758889a90d935b6f9325f for SPIRV-Registry and ba29b3f59633836c6bb160b951007c8fc3842dee for SPIRV-Headers. Newer Registry/Headers versions were not used because (1) there are a *lot* more features, more than the current Feature.Set.needed_bit_count and (2) the current update_spirv_features.zig cannot handle some of the new files, e.g. https://raw.githubusercontent.com/KhronosGroup/SPIRV-Registry/main/extensions/EXT/SPV_EXT_relaxed_printf_string_address_space.asciidoc
- Loading branch information