On Thu, 22 Jun 2017 10:29:59 -0700, c...@zoffix.com wrote:
> I'd expect the fancy Unicode versions of <=, >=, and != to perform
> equally well, instead the
> ≥ and ≤ are 36x slower than their Texas companions and ≠ is 15x
> slower.
> 
> Here's the timings for >= vs ≥:
> 
> m: my $x = rand; for ^1000_000 { $ = $x >= 1_000_000_000_000 }; say
> now - INIT now;
> rakudo-moar 43c176: OUTPUT: «0.74663187␤»
> m: my $x = rand; for ^1000_000 { $ = $x ≥ 1_000_000_000_000 }; say now
> - INIT now;
> rakudo-moar 43c176: OUTPUT: «(timeout)»
> m: my $x = rand; for ^1000_0 { $ = $x ≥ 1_000_000_000_000 }; say now -
> INIT now;
> rakudo-moar 43c176: OUTPUT: «0.2661272␤»
> m: say 0.2661272*100 / 0.729002
> rakudo-moar 43c176: OUTPUT: «36.505689␤»


So I made the static optimizer change Mexico ops to Texas versions, so this 
problem no longer exist. So, should the ticket be closed?

Fixed in https://github.com/rakudo/rakudo/commit/6ec21cb473

I tried writing a test, but couldn't get anything usable. My attempt was this:

    use Test;
    subtest 'performance of ≤, ≥, ≠ compared to Texas versions' => {
        sub measure (&code) { code for ^300; with now { code for ^100_000; now 
- $_ } }
    
        is-approx { rand ≤ rand }.&measure, { rand <= rand }.&measure, '≤', 
:rel-tol<.5>;
        is-approx { rand ≥ rand }.&measure, { rand >= rand }.&measure, '≥', 
:rel-tol<.5>;
        is-approx { rand ≠ rand }.&measure, { rand != rand }.&measure, '≠', 
:rel-tol<.5>;
    }

Reply via email to