in reply to Procedural Perl slower than OO Perl!!!

To my great suprise the OO version seems to work faster despite having more lines of code and additional complexity. Can anyone explain why?

Given that the procedural code you've posted here is still an order of magnitude slower than this version, the difference in performance between the two versions you've posted comes down to differences in the algorithms, and the implementations of those algorithms, not to the relative performance of perl's function and method calls.

The two posted versions do not even produce the same solution, so you are comparing apples with oranges and claiming the lemon juice produced tastes sweeter.


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: Procedural Perl slower than OO Perl!!! (Not!)

Replies are listed 'Best First'.
Re^2: Procedural Perl slower than OO Perl!!! (Not!)
by stvn (Monsignor) on Dec 23, 2010 at 19:25 UTC
    the difference in performance between the two versions you've posted comes down to differences in the algorithms

    Exactly. And really if he wants slow OO, he should use Moose.

    p.s. - This is my Christmas present to you BrowserUK ;)

    -stvn

      Touché!

      (S'il veut vraiment, vraiment lent, il peut passer de son algorithme génétique à la force brutale de procédure. :)

      Merry Christmas stvn.


      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.