Skip to content
Permalink
Browse files

Make say(\x) about 8% faster

Adaptation of #2734 , scovit++ for the
spotting of this opportunity.  Alas, we need to call .gist in the say sub
as we have spectest that depend on `say` calling `.gist` even on `Str`.
  • Loading branch information...
lizmat committed Mar 4, 2019
1 parent a8cd286 commit 9770c1aa15fff0f54df2af0291be2c07c0de486e
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/core/io_operators.pm6
@@ -10,8 +10,11 @@ multi sub print(**@args is raw) { $*OUT.print: @args.join }
proto sub say(|) {*}
multi sub say() { $*OUT.print-nl }
multi sub say(\x) {
my $out := $*OUT;
$out.print(nqp::concat(nqp::unbox_s(x.gist),$out.nl-out));
nqp::if(
nqp::istype((my $out := $*OUT),IO::Handle),
$out.say(x.gist),
$out.print(nqp::concat(nqp::unbox_s(x.gist),$out.nl-out))
)
}
multi sub say(**@args is raw) {
my str $str;

0 comments on commit 9770c1a

Please sign in to comment.
You can’t perform that action at this time.