News for hackers. Stuff that matters.
Re:My personal C coding style as of late 2023 by Lockal on Monday October 09, 2023 @07:17AM (#37819160)
Just a note: defining own integer types has sense for resource-limited platforms. Most common type I see is something like "dim_t", which is 32-bit or 64-bit depending on use-case. 32-bit integers are often used even on 64-bit platforms in pointer compression schemes (for example, allocate your own heap and only store 32-bit offsets). This not only gives 2x improvement on memory usage for <4GB workloads, but it also improves performance due to better cache locality.
Re:My personal C coding style as of late 2023 by adrianN on Monday October 09, 2023 @08:46AM (#37819880)
How does it improve locality?
Re:My personal C coding style as of late 2023 by rocqua on Monday October 09, 2023 @09:00AM (#37820026)
More 'pointers' (32 bit offset ints) fit on a single cache line. Or, put differently, a list off offsets is half as long amd hence everything om the list is twice as close to everything else on the list.