News for hackers. Stuff that matters.
Re:Why Rust helps even if you have to use a lot of `unsafe` by imtringued on Wednesday August 02, 2023 @12:04PM (#36972756)
Unfortunately, that isn't what cache unfriendly means. You're concerned about wasting memory bandwidth. Your array is trivial to prefetch.
Re:Why Rust helps even if you have to use a lot of `unsafe` by flohofwoe on Wednesday August 02, 2023 @12:14PM (#36972910)
AFAIK the prefetcher doesn't help much if it's mainly busy with prefetching padding bytes of the 'inactive' unions (and I think even a smart prefetcher would at least always load whole cache lines which could be packed with active data instead). Of course that's also a bandwidth problem, you're wasting bandwidth loading data into the cache which then is ignored.