in reply to Re^10: rough approximation to pattern matching using local (Multi Subs)
in thread rough approximation to pattern matching using local
P6 will pretty much always need to inspect every parameter to a function call at runtime in order to determine which multi-sub to invoke.
Aiui P6 by design, and Rakudo in actuality, pretty much always resolve the dispatch target of a call with multisub candidates at compile-time, not run-time. See my previous comment in this thread for more details.
My overall point is that adding the syntactic convenience of multi-subs to P6 -- which will probably never be able to benefit from such optimisations -- is another nail in its coffin for programming where performance is important.
If you've read the comment I linked above you've hopefully switched to accepting that P6 multisubs in general, and as they have been used in P6 code to date, appear to perform roughly the same, speed-wise, as non multi subs in current Rakudo.
You've hopefully also seen why I think a literal parameter is supposed to be considered a singleton value, which in turn is acceptable as a finite set of values, which in turn enables the multisub resolution to stay compile-time. And why this isn't yet the case with Rakudo.
Even assuming that most multisub dispatches (in P6) are resolved at compile-time (and are thus no slower than non multi sub dispatches in P6), something about sub dispatching and calling in P6 leads to it being -- at least in my tests in this thread -- one or two orders of magnitude slower than perl (5) sub dispatches. Why?
One reason is missing optimizations. While Rakudo has been getting faster most months for years, the classic optimization phases and mechanisms now built in to Rakudo, NQP and MoarVM only landed last year. Folk have to actually use them to add the thousands of significant optimizations that are possible. Jonathan is wisely leaving these for others to pick off at their leisure while he focuses on stuff that realistically only he can do. Can sub dispatch get a whole lot faster? My guess is yes, way faster, but I'll investigate that guess and report back here on what I hear is possible.
Could P6 deliver value for some applications where performance is important? Several P6ers have written video games with Rakudo and I assure you they all think (enough) performance is very important! :) But seriously, I agree that Rakudo doesn't currently look like a strong candidate for writing high performance computing applications. To put it mildly. :)
Some news about incremental improvements:
»ö« . o O ( "the celebrity tell-all of the Perl-6 cult?" )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: rough approximation to pattern matching using local (Multi Subs)
by BrowserUk (Patriarch) on Feb 05, 2015 at 04:15 UTC | |
by raiph (Deacon) on Feb 09, 2015 at 07:22 UTC |