Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Properly optimize say/note, jnthn++
Committing optimizations without benchmarking them is like drinking from a
random bottle you find in the shed.  It might be nicely matured homebrew you
forgot about, or it could are arsenic.
  • Loading branch information
lizmat committed Jun 16, 2014
1 parent 54e264e commit 354c5c5
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/core/IO.pm
Expand Up @@ -8,8 +8,16 @@ sub print(|) {
}

proto sub say(|) { * }
multi sub say(Str:D \x) { $*OUT.print(x, "\n") }
multi sub say(\x) { $*OUT.print(x.gist, "\n") }
multi sub say(Str:D \x) {
my $out := $*OUT;
$out.print(x);
$out.print("\n");
}
multi sub say(\x) {
my $out := $*OUT;
$out.print(x.gist);
$out.print("\n");
}
multi sub say(|) {
my $args := nqp::p6argvmarray();
my $out := $*OUT;
Expand All @@ -18,8 +26,16 @@ multi sub say(|) {
}

proto sub note(|) { * }
multi sub note(Str:D \x) { $*ERR.print(x, "\n") }
multi sub note(\x) { $*ERR.print(x.gist, "\n") }
multi sub note(Str:D \x) {
my $err := $*ERR;
$err.print(x);
$err.print("\n");
}
multi sub note(\x) {
my $err := $*ERR;
$err.print(x.gist);
$err.print("\n");
}
multi sub note(|) {
my $args := nqp::p6argvmarray();
my $err := $*ERR;
Expand Down

0 comments on commit 354c5c5

Please sign in to comment.