Re: Benchmark for Scala, Ruby and Perl

Paul Procacci <[email protected]>
Newsgroups gmane.comp.lang.perl.perl6.user,gmane.comp.lang.perl.beginners
Message-ID <CAFbbPujuiffwhqovwQSCgkS7w2nqXCMxnZW2HFxBLYX7y2nw6g@mail.gmail.com>
On Sat, Jan 15, 2022 at 5:03 AM Jon Smart <[email protected]> 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).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.