You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"42 < $a < 666" should be faster than "42 < $a && $a < 666", but is 2x as slow
Expected Behavior
42 < $a < 666 should be faster
Actual Behavior
42 < $a < 666 is twice as slow
Steps to Reproduce
m: my $a = 42; for ^1000000 { my $b = 42 < $a < 666 }; say now - INIT now
<+camelia> rakudo-moar 7a4743b: OUTPUT: «0.54265194»
m: my $a = 42; for ^1000000 { my $b = 42 < $a && $a < 666 }; say now - INIT now
<+camelia> rakudo-moar 7a4743b: OUTPUT: «0.2490039»
Environment
Operating system:
Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Compiler version (perl6 -v):
This is Rakudo version 2017.12-111-g8023d21 built on MoarVM version 2017.12-20-g5710340
implementing Perl 6.c.
The text was updated successfully, but these errors were encountered:
- just like with DateTime.new earlier today
- JITting *is* taking place here, so not sure what the difference is
- replacing 1 <= $a <= 12 by 1 <= $a && $a <= 12 would make it 30% faster still
- but am not sure that's a currently botched optimization in Moar or not
- so keeping the code like this for now
- see GH #1368
- also, did not change self === Date to nqp::istype(self.WHAT,Date)
- because the effect was only about 0.5%, so maybe for later
- Makes 2.4x faster chains like 2 < $a < 1337
- Makes 2 < $a < 1337 run about the same speed as 2 < $a && $a < 1337
Phixes #1368
- With longer chains, the chain version comes out noticeably faster
than non-chained version with && ops
The Problem
"42 < $a < 666" should be faster than "42 < $a && $a < 666", but is 2x as slow
Expected Behavior
42 < $a < 666 should be faster
Actual Behavior
42 < $a < 666 is twice as slow
Steps to Reproduce
m: my $a = 42; for ^1000000 { my $b = 42 < $a < 666 }; say now - INIT now
<+camelia> rakudo-moar 7a4743b: OUTPUT: «0.54265194»
m: my $a = 42; for ^1000000 { my $b = 42 < $a && $a < 666 }; say now - INIT now
<+camelia> rakudo-moar 7a4743b: OUTPUT: «0.2490039»
Environment
Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
perl6 -v
):This is Rakudo version 2017.12-111-g8023d21 built on MoarVM version 2017.12-20-g5710340
implementing Perl 6.c.
The text was updated successfully, but these errors were encountered: