File seek perfomance

Hello world here is a paragraph from the book "Programming Rust" by Jim Blandy, page 482 :

Seeking within a file is slow. Whether you’re using a hard disk or a solid-state drive
(SSD), a seek takes as long as reading several megabytes of data.

I find that information incredible in addiction to being little precise. Is it true ? Other sources on the web tend to say the opposite.

Any complete answer includes a caveat for poor implementations and filesystems, but generally speaking, no it is not true. You can assume seeks are fast, much faster than reading every intervening byte, say. That's pretty much their point.


Unless you're frequently seeking forwards or backwards by a handful of bytes[1], I can't imagine how seeking could consistently be much slower than reading the data between your current position and the destination of the seek.

I'd be interested to hear what the author is basing that claim on. An (extremely simplistic) test I threw together didn't show occasionally seeking forward by 10 MB to be any slower than reading continuously on Windows 11.

  1. which might be slower because you're doing a bunch of extra syscalls ↩︎


Is that really a quote?

I'm curious to know what the author believes happens when a solid-state drive "seeks".

False in every possible sense for solid-state drives.