Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Certainly there can be severe overhead in calling functions unnecessarily. Your example accessor is also not optimized very well: It's doing both read and write, and checking for the difference.
More important is that the programmer know that her use of accessors, in her specific program, is a specific bottleneck. Sure, you might be using accessors in a 100-iteration tight loop, but if you're doing a fetch across the network in between calls to the loop, then that tight loop which may be "inefficient" on its own may be a trivial percentage of execution time.
Rule 1: Premature optimization is the root of all evil.
xoxo, In reply to Re: Re: Make your classes use their own methods
by petdance
|
|