client: manual better packing structure in memory layout
Due to the RAM crisis and the fact that xfwm4 is running in the background, I suggest paying more attention to packing structures in memory, or rather optimizing types and using the forgotten technology C bit-fields of an ancient civilization.
Using gboolean is very wasteful, I tried to promote the idea of reducing the size in GNOME glib, but they ignore the problem.
https://docs.gtk.org/glib/types.html
gboolean it macro for gint 4 byte! not 1 byte as char or bool in stdbool
Therefore, everything that actively uses glib depends very much on CPU cache size/speed and has more RAM consumption.
I described the changes in detail to each commit and provided links to sources.
References:
- Bit-fields in C: Explains the concept and usage of bit-fields for memory optimization. https://www.geeksforgeeks.org/bit-fields-c/
- Structure Padding in C: Details why compilers add padding and how field reordering can reduce it. https://www.geeksforgeeks.org/structure-padding-c-language/
- Understanding Memory Layout of C Structs: A comprehensive guide on struct memory organization, including padding and alignment. https://www.digitalocean.com/community/tutorials/understanding-memory-layout-of-c-structs
- Memory Alignment and Struct Packing: Provides an overview of memory alignment and how it affects struct size and performance. http://www.gribblelab.org/CBootCamp/7_Memory_Layout_and_Alignment.html
- Data Locality: Explains why compact memory layouts and efficient data access patterns are crucial for cache performance. https://en.wikipedia.org/wiki/Data_locality
Edited by Herman Semenoff