Improving efficiency involves doing less work ▸ An efficient program is one which does the minimum (that we’re aware of) amount of work to accomplish a given task 10 — 2020/07/08
performance involves doing work faster ▸ What does it mean to improve the performance of software? ▸ The software is going to run on a specific, real machine. There is some theoretical limit on how quickly it can do work 11 — 2020/07/08
▸ 12+ cores per socket ▸ 3+ execution ports per core ▸ 36,000,000,000 instructions per second ▸ All of the time spent waiting for data (ok, 50%) 22 — 2020/07/08
All traversal operations chase pointers to totally new memory ▸ In most cases, every step is a cache miss ▸ Only use this when you rarely traverse the list, but very frequently update the list 25 — 2020/07/08
▸ If the queue can have a total upper bound and/or is short-lived, consider using a vector with an index into the front ▸ Grow the vector forever, chase the tail with the index 26 — 2020/07/08
binary tree ▸ All the downsides of linked lists ▸ Insertion and removal are also partial traversals ▸ Even with hinting, every rebalancing is a traversal ▸ But you can use std::unordered_map, right? 27 — 2020/07/08
addressing into a table of the key-value pairs. ▸ Table stored as contiguous range of memory ▸ Use local probing on collisions to find an open slot in the same cache line (usually) → cuckoo hashing ▸ Keep both key and values small 29 — 2020/07/08
ever ▸ C++ helps you control them ▸ Attend to your algorithms! ▸ Use contiguous, dense, cache-oriented data structures ▸ Have fun writing crazy fast C++ code 30 — 2020/07/08