Tim Smith wrote:
> In article
> <8d204e7c-3377-4b9b-bbf0-e0b33122285c@p25g2000hsf.googlegroups.com>,
> dave_mikesell@fastmail.fm wrote:
>>> Java: 485, 469, 502
>>> C++: 181, 182, 192
>>> Perl: 328, 269, 292
>> Interpreted Perl whipped your Java version? Beware, you are about to
>> incur the Wrath of Razii!
>
> Note that the task hit two things Perl is designed to be good at:
>
> 1. Reading an entire file and storing it line by line into an array.
>
> 2. Sorting an array.
>
> I have not looked at how Perl is actually implemented, but I would not
> be surprised if there was a C function down in Perl somewhere to slurp a
> file into an array, and another to sort an array.
>
There probably is. As an experiment, I changed the C++ version to use
file mapping rather than iostreams to read the file. For the 10bible
test on my test machine, the time to read the file (without creating
strings) into a multiset changed from 1510ms to 570ms. So the
reading/sorting can certainly be optimised.
--
Ian Collins.