Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


clang-tidy has an extension to do just that: 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.


Bolt can do quite a lot of optimizations: https://github.com/llvm/llvm-project/tree/main/bolt


clang has -Wpadded to warn about added alignment padding, but it's really noisy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: