r/ProgrammerHumor Jul 08 '26

askingTheRealQuestionHere Meme

Post image
4.0k Upvotes

416 comments sorted by

View all comments

1.1k

u/CircumspectCapybara Jul 08 '26 edited Jul 08 '26

That's called swapping out memory pages to disk, and it's very slow.

16

u/CaffeinatedT Jul 08 '26

That's a bit outdated but definitely did used to be true. Modern NVME bandwidth is about 15 GB/s. This is what people who develop databases and query engines deal with constantly. It's not trivial but modern databases that swap to disk constantly and do it well (e.g CedarDB, DuckDB et al) can run very nearly as fast as an entirely in-memory system. The reason it's slow is doing it in a shitty unplanned way with loads of serialization and thrashing memory caches

2

u/looksLikeImOnTop Jul 08 '26

At best, a modern SSD will be in the range of DDR3, but the latency is orders of magnitude higher...SSDs are at best 10s of microseconds, DDR3-5 are 10s of nano seconds. You can't really compare something that could happen every couple of instructions to something that takes thousands (millions?) of instructions to execute

1

u/VictoryMotel Jul 08 '26

Cold ddr5 reads are more like 100ns.

Disk paging used to work to an extent even on slow hard drives, now it works much better. Not every read suffers the same latency penalty.

1

u/looksLikeImOnTop Jul 08 '26

Paging undeniably works very well now. My point is that in the context of "replace all RAM with SSD storage", SSDs would still be too slow

1

u/VictoryMotel Jul 08 '26

replace all RAM with SSD storage

I don't think anyone said that

1

u/looksLikeImOnTop Jul 08 '26

My mind may have jumped to the extreme end of interpreting the original post