Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

RE: RE: Sorting a list of IP addresses (aka Why I hate Big O)

by tilly (Archbishop)
on Aug 08, 2000 at 01:07 UTC ( #26658=note: print w/replies, xml ) Need Help??

in reply to RE: Sorting a list of IP addresses (aka Why I hate Big O)
in thread Sorting a list of IP addresses (aka Why I hate Big O)

There is a very interesting point about Perl and algorithmic efficiency. Perl makes it very natural for people to use highly optimized pattern recognition algorithms in the regular expression engine, and a good hashing algorithm.

C, while much faster, makes it far more natural to repeatedly scan lists rather than store a key in a hash and just check exists.

The result is that the same person in many circumsances will find that their Perl code not only is easier to write and read, but outperforms what they would have written in C. Sure, if they wrote their C carefully they would beat Perl every time. But natural Perl idioms tend to be better algorithmically than the natural C approaches, and algorithmic efficiency trumps raw performance.

(This does not hold true for all programmers, YMMV, etc. But it is surprising how often it is true.)

  • Comment on RE: RE: Sorting a list of IP addresses (aka Why I hate Big O)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://26658]
[GotToBTru]: i am satisfied with the default settings turning the seemingly random formatting into something reliable
[Corion]: GotToBTru: Yeah, I started a quick(ly implemented but slowly running) implementation of a program that would guess the "best" configuration (that is, least amount of changes) from my code, but then found that it stops parsing the source as soon as it ..
[GotToBTru]: sadly, it can't do anything about this
[Corion]: ... encounters sub foo($bar,$baz) {, which is something I like nowadays
[Corion]: GotToBTru: Yeah, that stuff is hard to do away automatically ;)
[GotToBTru]: yeah, you mentioned it could not handle signatures
[Corion]: And so far I like signatures and nobody has yet come up to me and screamed at me for implementing a source filter to handle them even on early Perl versions ;)

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (15)
As of 2017-02-27 14:38 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (387 votes). Check out past polls.