r/cpp • Meeting C++ | C++ Evangelist • Sep 24 '26

About alignment, struct layout and the cache...

https://meetingcpp.com/blog/items/About-alignment--struct-layout-and-the-cache---.html
36 Upvotes

27 comments sorted by

View all comments

Show parent comment

2

u/ReDucTor Game Developer | quiz.cpp-perf.com Sep 27 '26

> asymptote towards array size

I've never used them but looking at them this wouldonly be the case if you have mostly long unblock blocks.

Additionally if you use a branch for inspect the node tag then your going to run into potential branch mispredictions, if you use branchless then you just end up with a long data dependency

2

u/pdp10gumby Sep 27 '26

Well sure, I"m not sure what your point is. As with every datastructure you have to choose based on optimal performance in a typical working set. I don't use linked lists often (few should) but of course in some cases they are the right choice, and if your use case reduces memory move upon updates that can be good or bad.