Skip Menu |
Report information
Id: 129941
Status: open
Priority: 0/
Queue: perl6

Owner: tbrowder <tom.browder [at] gmail.com>
Requestors: tbrowder <tom.browder [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: Tom Browder <tom.browder [...] gmail.com>
Subject: [BUG] Perl 6 text file line read is much slower than Perl 5
To: rakudobug [...] perl.org
Date: Sat, 22 Oct 2016 06:23:09 -0500
Download (untitled) / with headers
text/plain 618b
See <https://github.com/tbrowder/perl6-read-write-tests> for a suite of tests that show the differences. For example (from the link above): Results of recent file read tests Date | Rakudo Version | File Size (lines) | Perl 5 RT | Perl 6 RT | P6/P5 ============================================================== 2016-10-18 | 2016.10-16-geb6907e | 1_000_000 | 1.39s | 12.61s | 25.2 2016-10-18 | 2016.10-16-geb6907e | 6_000_000_000 | 75.47s | 737.63s | 18.2 2016-10-18 | 2016.10-16-geb6907e | 10_000_000_000 | 121.33s | 1233.29s | 25.1 Notes: RT - run time
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Subject: Re: [perl #129941] [BUG] Perl 6 text file line read is much slower than Perl 5
To: "Tom Browder (via RT)" <perl6-bugs-followup [...] perl.org>
Date: Sat, 22 Oct 2016 15:30:06 +0200
Download (untitled) / with headers
text/plain 1.1k
Would you believe it used to be a lot slower still? Anyways, what does P6/P5 mean?? If it’s the runtimes divided, I get values between 9 and 10 or so. Which would be less surprising to me. Show quoted text
> On 22 Oct 2016, at 13:24, Tom Browder (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Tom Browder > # Please include the string: [perl #129941] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=129941 > > > > See <https://github.com/tbrowder/perl6-read-write-tests> for a suite > of tests that show the differences. > > For example (from the link above): > > Results of recent file read tests > > Date | Rakudo Version | File Size (lines) | Perl 5 > RT | Perl 6 RT | P6/P5 > ============================================================== > 2016-10-18 | 2016.10-16-geb6907e | 1_000_000 | 1.39s | > 12.61s | 25.2 > 2016-10-18 | 2016.10-16-geb6907e | 6_000_000_000 | 75.47s | > 737.63s | 18.2 > 2016-10-18 | 2016.10-16-geb6907e | 10_000_000_000 | 121.33s | > 1233.29s | 25.1 > > Notes: > > RT - run time
Download (untitled) / with headers
text/plain 192b
On Sat Oct 22 04:24:15 2016, tbrowder wrote: Show quoted text
> See <https://github.com/tbrowder/perl6-read-write-tests> for a suite > of tests that show the differences.
Suite has been updated considerably.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.5k
On Mon, 24 Oct 2016 03:27:55 -0700, tbrowder wrote: Show quoted text
> On Sat Oct 22 04:24:15 2016, tbrowder wrote:
> > See <https://github.com/tbrowder/perl6-read-write-tests> for a suite > > of tests that show the differences.
> > Suite has been updated considerably.
In a benchmark on my local machine, after many improvements, I now see Perl 6 coming out slightly ahead of Perl 5 when the UTF-8 encoding is being used: $ time perl6 -e 'my $fh = open "longfile"; my $chars = 0; for $fh.lines { $chars = $chars + .chars }; $fh.close; say $chars' 60000000 real 0m1.081s user 0m1.168s sys 0m0.032s $ time perl -e 'open my $fh, "<:encoding(UTF-8)", "longfile"; my $chars = 0; while ($_ = <$fh>) { chomp; $chars = $chars + length($_) }; close $fh; print "$chars\n"' 60000000 real 0m1.110s user 0m1.088s sys 0m0.020s The situation with ASCII/latin-1 is still not quite so rosy: $ time perl -e 'open my $fh, "<", "longfile"; my $chars = 0; while ($_ = <$fh>) { chomp; $chars = $chars + length($_) }; close $fh; print "$chars\n"' 60000000 real 0m0.277s user 0m0.260s sys 0m0.016s $ time ./perl6-m -e 'my $fh = open "longfile", :enc<ascii>; my $chars = 0; for $fh.lines { $chars = $chars + .chars }; $fh.close; say $chars' 60000000 real 0m0.988s user 0m1.028s sys 0m0.068s Though that's now down to a factor of 3.5x, which is hugely better than the factor of 9 or 10 before. What are the conditions for resolving this issue? Clearly the UTF-8 case is good enough because Perl 6 is winning there, but "much slower" is a bit subjective, so hard to know when we're there (unless we somehow manage to win in the ASCII case too...) :-) /jnthn
Date: Tue, 12 Sep 2017 17:13:16 +0000
To: perl6-bugs-followup [...] perl.org
CC: perl6-compiler [...] perl.org
Subject: Re: [perl #129941] [PERF] [IO] Perl 6 text file line read is much slower than Perl 5
From: Tom Browder <tom.browder [...] gmail.com>
Download (untitled) / with headers
text/plain 1.2k
On Tue, Sep 12, 2017 at 09:23 jnthn@jnthn.net via RT <perl6-bugs-followup@perl.org> wrote:
Show quoted text
On Mon, 24 Oct 2016 03:27:55 -0700, tbrowder wrote:
> On Sat Oct 22 04:24:15 2016, tbrowder wrote:
> > See <https://github.com/tbrowder/perl6-read-write-tests> for a suite
> > of tests that show the differences.
>
> Suite has been updated considerably.

In a benchmark on my local machine, after many improvements, I now see Perl 6 coming out slightly ahead of Perl 5 when the UTF-8 encoding is being used:
...
Show quoted text
The situation with ASCII/latin-1 is still not quite so rosy:
...
Show quoted text
Though that's now down to a factor of 3.5x, which is hugely better than the factor of 9 or 10 before.

What are the conditions for resolving this issue? Clearly the UTF-8 case is good enough because Perl 6 is winning there, but "much slower" is a bit subjective, so hard to know when we're there (unless we somehow manage to win in the ASCII case too...) :-)

Jonathan, thanks for your continued work in this area. I agree that "much slower" is not very specific.  Unless you are aware of some code remaining to work on someday, I guess we are at the "good enough" point, especially given that p6 is beating p5 in urf8!

Let me run my tests again to see how it "feels" in my world.

Best,

-Tom


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org