Skip Menu |
Report information
Id: 128055
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: calvin.schwenzfeier [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Mon, 2 May 2016 20:56:44 +0100
From: Calvin Schwenzfeier <calvin.schwenzfeier [...] gmail.com>
Subject: [PERF] Significant slowdown of multi-methods when the not-called one uses a "where" restriction.
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 745b
From the #perl6 channel:

Show quoted text
cschwenz
8:46 p6: class Foo { multi method aaa() { my Int $y = 0; }; multi method aaa(Int $x = 1) { my Int $y = $x; }; }; my Instant $t1 = now; for (1 .. 10000) { Foo.aaa() }; my Instant $t2 = now; my $d1 = ( $t2 - $t1 ).narrow; say "$d1";
camelia
8:46 rakudo-moar ef3e62: OUTPUT«0.00490609␤»

cschwenz
8:46 p6: class Foo { multi method aaa() { my Int $y = 0; }; multi method aaa(Int $x where $x > 0 = 1) { my Int $y = $x; }; }; my Instant $t1 = now; for (1 .. 10000) { Foo.aaa() }; my Instant $t2 = now; my $d1 = ( $t2 - $t1 ).narrow; say "$d1";
camelia
8:46 rakudo-moar ef3e62: OUTPUT«0.31616794␤»

Of note, the "where" restriction is placed on the multi-method which is not called.

Hope that helps,
~Cal



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org