Building a high performance JSON parser
Golang Weekly Issue 319: July 3, 2020
HW improvements are getting slower
When you look at single core performance, the fastest 2019 Core i9 is less than twice as fast as the fastest 2011 Core i7. Instead of getting faster, we're adding more cores to CPUs. When you look at multi-core performance, it's a little better, slightly more than 2x faster.
- It’s not just CPU performance that is limiting us. Forrest Smith wrote a fantastic blog post on the impact of RAM and RAM access patterns on performance. The highlights are:
- RAM is much slower than CPUs, and the gap is not getting better, even though CPUs aren't getting much faster.
- RAM might be random access, but if you actually use it that way, it's slow. You can read around 40 gigabytes per second from RAM on a modern Intel CPU if the data is sequential. If you do a random read, it’s a little less than half a gigabyte per second.
- Code with lots of pointers is especially slow. Quoting Forrest: “Sequentially summing values behind a pointer runs at less than 1 GB/s. Random access, which misses the cache twice, runs at just 0.1 GB/s. Pointer chasing is 10 to 20 times slower. Friends don't let friends use linked lists.” Ouch.