Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
A couple of IO performance improvements. .say for @some_list_of_strin…
…gs now runs in under half the time, and we shave a little bit off the spectest runtime too.
  • Loading branch information
jnthn committed Nov 1, 2011
1 parent 0f582d8 commit 9fc3eb2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/core/IO.pm
@@ -1,7 +1,6 @@
# XXX Relatively cheaty, just to get us able to output something.
# But you should see what USED to be here! O.O
sub print(*@list) {
$*OUT.print(@list.shift) while @list.gimme(1);
sub print(|$) {
my $args := pir::perl6_current_args_rpa__P();
$*OUT.print(nqp::shift($args)) while $args;
Bool::True
}

Expand All @@ -11,7 +10,7 @@ sub say(|$) {
$*OUT.print("\n");
}

sub note(*@list) {
sub note(|$) {
my $args := pir::perl6_current_args_rpa__P();
$*ERR.print(nqp::shift($args).gist) while $args;
$*ERR.print("\n");
Expand Down Expand Up @@ -113,7 +112,12 @@ class IO {
nqp::p6bool(nqp::istrue($!PIO));
}

method print(IO:D: *@list) {
proto method print(|$) { * }
multi method print(IO:D: Str:D $value) {
$!PIO.print(nqp::unbox_s($value));
Bool::True
}
multi method print(IO:D: *@list) {
$!PIO.print(nqp::unbox_s(@list.shift.Str)) while @list.gimme(1);
Bool::True
}
Expand Down

0 comments on commit 9fc3eb2

Please sign in to comment.