3 ms·
On the other hand, I for one would happily throw such brittle, unportable code under the bus in the name of automatically reduce cache line missing. About the
by antimagic 13y ago
On the other hand, I for one would happily throw such brittle, unportable code under the bus in the name of automatically reduce cache line missing.
About the only safe usage of structure memory layout that I can think of is offsetof, and even then, I think you could make offsetof's behaviour definable in the ABI to make it deterministic.
- dfox 13y agoThat unportable code includes CPython, Sun JVM, essentially anything GUI related in Windows and anything that uses BSD sockets.
- EpicEng 13y agoI'm not sure you know what "unportable" means. Every program compiled by a compliant compiler will work. "unportable" doesn't apply to compilers which do the wrong thing, it applies to programs which do not assume anything outside what is in the specification.
- MaulingMonkey 13y ago> On the other hand, I for one would happily throw such brittle, unportable code under the bus in the name of automatically reduce cache line missing. Spoken like someone who's never been forced to fix such code left behind by previous coders. > About the only safe usage of structure memory layout that I can think of is offsetof, and even then, I think you could make offsetof's behaviour definable in the ABI to make it deterministic. Sure, especially considering offsetof is standard defined and allowed to be compiler implemented AFAIK. That said, you bring up a great point: You're talking about breaking decades old ABIs if you were to enable such memory layout reordering by default. Good luck tracking down updated .libs or original source to build .libs from for every single one of your dependencies!