all: reduce type, align for 64-bit, using autopadding memholes after swap fields #108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@tkanteck, @hpax
Using Pahole memory struct/class analyzer (from Red Hat https://linux.die.net/man/1/pahole) on object files after compilation, you can find places that are problematic for CPU cache, C/C++ compiler does not have automatic filling and alignment memholes and relies on programmer, since struct packaging can break behavior program, and for this there are keywords for packaging structures.
I also tried to keep previous order fields so as not to break style code.
I did not find in the documentation how to run nasm benchmark to compare PR and master, but in any case, leveling and reducing the size of structures reduces RAM usage since they can fit into the processor cache line.
I don't mind running a benchmark if someone tells me how. Maybe build speed on especially large projects will really be different.
Reduce type sizes:
Reduce structure sizes:
Pahole example output with
struct coff_Section
:/* XXX {n} bytes hole, try to pack */
shows where optimization is possible by rearranging the order of fields structures and classes or swap to end struct for autopadding by compilerMaster branch
PR
References:
https://hpc.rz.rptu.de/Tutorials/AVX/alignment.shtml
https://wr.informatik.uni-hamburg.de/_media/teaching/wintersemester_2013_2014/epc-14-haase-svenhendrik-alignmentinc-presentation.pdf
https://en.wikipedia.org/wiki/Data_structure_alignment
https://stackoverflow.com/a/20882083
https://zijishi.xyz/post/optimization-technique/learning-to-use-data-alignment/