Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^5: what would you like to see in perl5.12?

by BrowserUk (Pope)
on Aug 09, 2008 at 20:57 UTC ( #703324=note: print w/ replies, xml ) Need Help??


in reply to Re^4: what would you like to see in perl5.12?
in thread what would you like to see in perl5.12?

Oh, you meant runtime performance! Sorry, I completely failed to recognize that.

Really? How very strange.

I heard this turns out to actually be faster than Perl 5 calling conventions,

That's worth a look. Is it packaged for install anywhere, or only available from the repositories?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re^5: what would you like to see in perl5.12?
Re^6: what would you like to see in perl5.12?
by gaal (Parson) on Aug 09, 2008 at 21:21 UTC
    The parse failure was wholly mine... Perl6::Signature and Devel::Declare are on CPAN, but you may need a newer version of the latter. Like I said, experimental.

      Sorry if I missed the correspondence between Perl6::Declare and Devel::Declare & Perl6::Signatures. If indeed there is any?

      Perl6::Declare lets you declare subroutine/methods using Perl 6 signatures, which are lovely. I heard this turns out to actually be faster than Perl 5 calling conventions,

      Devel::Declare talks about "declarator magic" and Perl6::Signature contains a Parse::RecDescent-based parser for signatures.".

      If anything that uses P::RD turns out to be faster than my( $x, $y, $z ) = @_;, it will indeed be "magic". Oh! and I'll eat my hat! (I'll have to buy a hat to eat, but I'm sure I can find something tasty at a thrift shop:)


      To clarify, what I meant by my request for less overhead, was a reduction in the internal (C-level) overhead associated with calling a perl subroutine, that results in this kind of comparison of similar subroutines coded in Perl and another bytecode compiled, interpreted language: Java.

      Are Perl's function calls slow?

      The archetypal test of function call performance is the Ackermann Function. Go here to see the list of other languages that out-perform Perl for function call performance. Many of those are fully pre-compiled languages. Many are not.

      For comparison purposes, look at straight forward implementations in Perl, with the same in Java.

      Perl:

      P:\test\MJD>ack1 9 Ack(3,9): 4093 78.843 83.671 0 0

      Java:

      P:\test\MJD>timethis "c:javac ackermann.java && java ackermann 9" TimeThis : Command Line : c:javac ackermann.java && java ackermann 9 TimeThis : Start Time : Fri Sep 02 22:01:28 2005 Ack(3,9): 4093 TimeThis : Command Line : c:javac ackermann.java && java ackermann 9 TimeThis : Start Time : Fri Sep 02 22:01:28 2005 TimeThis : End Time : Fri Sep 02 22:01:29 2005 TimeThis : Elapsed Time : 00:00:01.031

      I've included the compilation and runtime for Java to even the score a little. JIT was not enabled.

      So 83.6 seconds for Perl, and 1.031 seconds for Java!

      Conclusion: Perl's function calls are slow.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Devel::Declare lets you hook into the perl parser and create your own bits of syntax. It's a little bit like a source filter, except more magical with all the good, bad, and ugly that can entail.

        Perl6::Signature's being P::RD-based is not material here. Once per function, at parse time, Perl6::Declare will parse the Perl 6 signature of a sub and install data binding (and possibly, runtime checks) as appropriate.

        The speed comes from another module (sorry to keep calling rabbits out of hats, those aren't the ones anyone gets to eat). It's Data::Bind, which too lacks documentation except for its tests. Word is it's in some cases faster than = @_.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://703324]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2014-08-23 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (174 votes), past polls