3 ms·
Do anyone know any tools (static or dynamic analysers) to automatically detect structures/classes they may be reordered to improve their packing? I think it can
by nokeya 2y ago
Do anyone know any tools (static or dynamic analysers) to automatically detect structures/classes they may be reordered to improve their packing? I think it can be quite useful or at least interesting
- ComputerGuru 2y agoclang-tidy has an extension to do just that: https://clang.llvm.org/extra/clang-tidy/checks/altera/struct-pack-align.html https://clang.llvm.org/extra/clang-tidy/checks/altera/struct... -- I think there are other clang-tidy padding-related checks that apply here as well, iirc. Also, not what you asked but certainly related, some lower-language levels (not just jit languages) can and do automatically re-arrange struct members (when not optionally fixed); e.g. by default rust will rearrange members as needed to optimize padding.
- pajko 2y agoBolt can do quite a lot of optimizations: https://github.com/llvm/llvm-project/tree/main/bolt https://github.com/llvm/llvm-project/tree/main/bolt
- throw16180339 2y agoclang has -Wpadded to warn about added alignment padding, but it's really noisy.