Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Switch the infix:<=> op to use the perl6 assignment opcode directly
instead of going through a sub to do it.  This results in a 29%
speed improvement on a simple    while $count < 100000 { $count++ }
benchmark.
  • Loading branch information
pmichaud committed Jun 22, 2011
1 parent 9ccc8eb commit 1bb9b53
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Perl6/Grammar.pm
Expand Up @@ -2105,8 +2105,8 @@ grammar Perl6::Grammar is HLL::Grammar {
token infix:sym<=> {
<sym>
[
|| <?{ $*LEFTSIGIL eq '$' }> <O('%item_assignment, :reducecheck<assign_check>')>
|| <O('%list_assignment, :reducecheck<assign_check>')>
|| <?{ $*LEFTSIGIL eq '$' }> <O('%item_assignment, :reducecheck<assign_check>, :pirop<perl6_container_store__0PP>')>
|| <O('%list_assignment, :reducecheck<assign_check>, :pirop<perl6_container_store__0PP>')>
]
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/operators.pm
Expand Up @@ -4,7 +4,7 @@
## Int/Rat/Num operators are in {Int|Rat|Num}.pm

sub infix:<=>(Mu \$a, Mu \$b) {
pir::perl6_container_store__0PP($a, pir::perl6_decontainerize__PP($b))
pir::perl6_container_store__0PP($a, $b)
}


6 changes: 4 additions & 2 deletions src/ops/perl6.ops
Expand Up @@ -506,7 +506,8 @@ otherwise, calls the .STORE method.

*/
inline op perl6_container_store(in PMC, in PMC) :base_core {
Rakudo_cont_store(interp, $1, $2, 1, 1);
Rakudo_cont_store(interp, $1,
Rakudo_cont_decontainerize(interp, $2), 1, 1);
}


Expand All @@ -523,7 +524,8 @@ already decided that it's safe).

*/
inline op perl6_container_store_unchecked(in PMC, in PMC) :base_core {
Rakudo_cont_store(interp, $1, $2, 0, 0);
Rakudo_cont_store(interp, $1,
Rakudo_cont_decontainerize(interp, $2), 0, 0);
}


Expand Down

0 comments on commit 1bb9b53

Please sign in to comment.