|Perl Monk, Perl Meditation|
Re: how to improve the performance of a perl programby BrowserUk (Pope)
|on Aug 05, 2013 at 17:03 UTC||Need Help??|
I have come to know about Devel::NYFTProf but not quite able to understand how to use it. The gui has a launching script which in turn calls some more scripts using some modules.
What do you not understand about how to use it?
You probably don't need to profile the gui itself, so how are you "calling" the other scripts from it?
Use faster accessors
The fastest accessor is the one you don't call.It may go against OO-dogma; but in 95% of cases, there is no good reason to use subroutines to access instance variables from within that class's methods.
There are three main reasons formally cited for using accessors within a class's methods:
In short. External code calls methods to perform services, not access internal data. Where service methods accept arguments; those arguments must be validated immediately; and once so validated; any values derived from those arguments that subsequently gets set into instance variables require no further validation.
Thus, method code can safely directly access instance variables. Which in turn avoids both the overhead of accessor method calls; and centralised re-validation.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.