Re:Don’t blindly prefer emplace_back to push_back
by lorenzhs on Thursday March 04, 2021 @06:22AM
(#26341090)
Several few decades ago, pointer chasing was much cheaper because the difference between an arithmetic operation and a memory access was far lower. CPUs in those times didn't even have caches (because they weren't needed). That made linked lists a reasonable choice. But CPU and memory speeds have been diverging -- both are growing at an exponential pace, but with different exponents, so the gap is also growing exponentially! So now we have a huge memory hierarchy and random accesses into memory are really slow and linked lists rarely make sense.
[ Parent
| on HN ]
Re:Don’t blindly prefer emplace_back to push_back
by masklinn on Thursday March 04, 2021 @06:36AM
(#26341165)
> Several few decades ago, pointer chasing was much cheaper because the difference between an arithmetic operation and a memory access was far lower.
Also allocation was just bumping the brk.