QFile seek performance

回眸只為那壹抹淺笑 提交于 2019-12-01 11:33:00

The short answer is "yes, for practical purposes". The long answer is... It's complicated.

Seeking on a file stream ultimately calls lseek() on the underlying file descriptor, whose performance depends on the kernel.

The running time will depend on what file system you are using and how large the files are. As the files get larger, random seeks require chasing more levels of "indirect" indexing blocks. But even for files up to 2^64 bytes, the number of levels is just a handful.

So in theory, seeking is probably O(log n); but in practice, it is essentially constant for a modern file system.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!