Skip Menu |
Report information
Id: 128388
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: hinrik <hinrik.sig [at]>

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

Subject: Callable.assuming() is slow
Download (untitled) / with headers
text/plain 298b
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
Download (untitled) / with headers
text/plain 623b
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 }

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

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