This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/core/IO.pm b/src/core/IO.pm | |
| index e011b01..5a364bd 100644 | |
| --- a/src/core/IO.pm | |
| +++ b/src/core/IO.pm | |
| @@ -214,10 +214,13 @@ sub close($handle) { | |
| } | |
| sub slurp($filename) { | |
| - my $handle = open($filename, :r); | |
| - my $contents = $handle.slurp(); | |
| - $handle.close(); | |
| - $contents | |
| + ## Although it's tempting to delegate to IO.slurp above, Parrot | |
| + ## currently suffers a serious (25x) performance degradation when | |
| + ## using readall() on an already-opened FileHandle. Much faster | |
| + ## is to use readall($filename), which we do here. See TT #1749. | |
| + my $PIO = Q:PIR { %r = root_new['parrot';'FileHandle'] }; | |
| + $PIO.encoding('utf8'); | |
| + $PIO.readall($filename); | |
| } | |
| sub unlink($filename) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment