Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Changing Perl's sort Default

by true (Pilgrim)
on Oct 23, 2002 at 04:27 UTC ( #207295=note: print w/replies, xml ) Need Help??


in reply to Re: Changing Perl's sort Default
in thread Changing Perl's sort Default

Can anybody ellaborate on this statement by Ovid. This small side note is interesting to me and i want to know more. I'm always interested in speeding up perl.

"As a small side note, be aware that providing a block or subroutine to the sort function will automatically slow down its performance as is will no longer be relying on straight C code to perform the sort. Naturally, I rarely feel it's necessary to consider this issue, but it's nice to know"
  • Why is it not straight C code? What is it?
  • Does this apply to any subroutine, or is 'sort' a special case?
  • Also, does the same issue hold true under mod_perl?
  • This reminds me of the rumor i heard that case non-sensitive pattern matching is particularly slow (/foo/i). Any ideas on how i could find out more about perl syntax and speed?
  • Replies are listed 'Best First'.
    Re: Re: Re: Changing Perl's sort Default
    by chromatic (Archbishop) on Oct 23, 2002 at 05:01 UTC

      It's not straight C code because it's Perl. Perl's default sort algorithm(s) are implemented in C, not Perl. Anytime you reimplement a built-in function in Perl, it'll be slower than if you used the default. It doesn't matter if you use mod_perl, as the big gain there is avoiding startup time.

      Regexp optimization is another subject altogether!

    Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (4)
    As of 2022-12-10 04:57 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?