Open p6rt opened 8 years ago
Calling .assuming() on a subroutine is way too slow for general usage.
$ time perl6 -e'sub foo { my &curry = &foo.assuming(); }; for 1..100 -> $x { foo() }'
real 0m4.235s user 0m4.192s sys 0m0.044s
$ time perl6 -e'sub foo { }; for 1..100 -> $x { foo() }' real 0m0.106s user 0m0.068s sys 0m0.036s
Agreed.
It's also not thread-safe (see ticket #127987), and its implementation is a real mess of spaghetti code. I think it's a safe bet that at some point that whole method will be rewritten, and that'll hopefully fix its slowness too.
For now, you can use a closure instead. So for example instead of this:
my &float-to-str = &sprintf.assuming("%f");
...write this:
my &float-to-str = { sprintf "%f", $_ };
In the general case (when you don't know how many and what type of variable parameters will be passed), the following two should behave the same:
&f.assuming($a, $b)
-> |c { f $a, $b, |c }
The RT System itself - Status changed from 'new' to 'open'
Migrated from rt.perl.org#128388 (status was 'open')
Searchable as RT128388$