in reply to Re^2: how to improve the performance of a perl program
in thread how to improve the performance of a perl program
$chain->of->accessors often isn't a problem. However, if you've identified a bottleneck, you may need to consider what work is being done:
If that sounds like a lot of work, you're jumping to conclusions. If you put all that inside of a tight loop, inside of an algorithm that computes the Cartesian product of two human DNA sequences, yes... it's way too much work to be doing inside of a tight loop. If you're diving into that chain of accessors only every so often, then all the object lookup and call-stack work really fades into the background, and you maybe need to just consider how much work the individual accessors are doing internally. But until you've identified bottlenecks, it's a total waste of your time and the salary your employer pays you to just start making untested assumptions about performance, because you could be looking completely in the wrong places.
As for your question about how to use Class::Accessor, before I explain how, let me ask you why you think you want to use it. Class::Accessor has about as much to do with code speed optimization as cruise controls have to do with drag racing. So if you do understand that Class::Accessor isn't a means to code speed optimization, and you still need it, then I suggest you read its documentation and ask a specific question about it, rather than asking "how to use" it when "how" is demonstrated right in its documentation.
Dave
|
|---|