On Sat, Jan 15, 2022 at 5:03 AM Jon Smart <j...@smartown.nl> wrote:

>
> Thanks Paul. I am surprised that mmap has that huge IO advantages
> comparing to the classic way. So ruby take more benefit from this mmap
> calling. Just get learned from your case.
>
> Regards
>
>
It's not always beneficial.  There are cases where one is more beneficial
over the other.
..... and unfortunately it's not really well defined when to use one over
the other.

The general consensus has been that if you plan on jumping around a lot in
a file, then mmap will be superior to read.
Otherwise when sequentially reading, then read will be superior to mmap.

The inclusion of my perl mmap version clearly disproves that ON MY OS.
It may be different ON YOUR OS.

This is partially why micro benchmarking is hard to do.  Your scripts will
almost certainly act one way on your machine, and different on others.
You may very well try an mmap version on your machine and scratch your head
because it's slower .... there's more than just the userland processes
involved here.  ;)

Goodnight (again).

Reply via email to