|Perl Monk, Perl Meditation|
Questions on Optimisation (DateTime::SpanSet and RRDs.pm)by smullis (Pilgrim)
|on Jan 26, 2005 at 13:28 UTC||Need Help??|
smullis has asked for the
wisdom of the Perl Monks concerning the following question:
I have a simple script that calculates the average values from a number of RRD files. I would now like to discard all data returned by RRDs::fetch that does not fall within working hours.
So, after some reading - and some trial and error - the following works:
For those unfamiliar with RRDs.pm, $data is an AoA ref.
The problem is, this is incredibly slow! I've qualitatively isolated the major slowdown to the "next unless $span_set->contains ( $dt )" -- this slows things down by a factor of 5.
dprofpp just segfaults when I try to profile the script.
Anyone have any suggestions as to how to optimise this? Is there another way rather than using Date::Time?
Many thanks in advance for any pointers / help / critisicism / suggestions.