Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significant slowdown of multi-methods when the not-called one uses a "where" restriction. #5292

Open
p6rt opened this issue May 2, 2016 · 1 comment
Labels

Comments

@p6rt
Copy link

p6rt commented May 2, 2016

Migrated from rt.perl.org#128055 (status was 'new')

Searchable as RT128055$

@p6rt
Copy link
Author

p6rt commented May 2, 2016

From calvin.schwenzfeier@gmail.com

From the #perl6 channel​:

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

@p6rt p6rt added the perf label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant