[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Note on OO function calls in Perl
From: |
Patrice Dumas |
Subject: |
Re: Note on OO function calls in Perl |
Date: |
Sun, 26 Apr 2015 21:27:38 +0200 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Sun, Apr 26, 2015 at 01:25:43PM +0100, Gavin Smith wrote:
> I tried replacing some of the object-oriented method calls in
> Parser.pm and Plaintext.pm to see if it would be any faster, e.g.
>
> - $result .= $self->_count_added($formatter->{'container'},
> + $result .= _count_added($self, $formatter->{'container'},
>
> but it didn't make any difference that I could notice. My timing
> measurements vary too much and I suspect they depend mostly on how
> overheated my laptop has been getting.
>
> This was recommended at
> http://makepp.sourceforge.net/2.0/perl_performance.html.
I would have doubted this would make a difference. However, I think
that it is better not use OO calls if not needed, that is, if
polymorphism is not needed for that function, so I think that those
patches are a good thing irrespective of speedups, for code readability.
With OO one never know which function is really called which I find
very annoying. Even though I used quite a bit of OO in texinfo for
polymorphism, I really dislike it, but as it can help simplifying code
sometime I used it...
--
Pat