Memory is slow, Disk is fast - Part 3

Jared Hulbert · Bitflux

TL;DR

Big O notation is a lie. Well, okay, it's a simplification that lies by omission.

Can O(√n) scale better than O(log n)? Can a disk-based algorithm outperform an in-RAM data structure? Yes, and yes.

AVL in RAM vs DiskArray on disk

Scaled to 2 billion nodes, the AVL binary tree needs 144 GiB of RAM. DiskArray keeps its data on 8 NVMe drives and uses 264 MiB of RAM, but it's still faster at everything.

Why a Part 3

Part 1 showed that computers are getting wider, not faster, and that PCIe bandwidth is outpacing DRAM bandwidth.

Part 2 showed that streaming from disk can beat streaming from the page cache.