in reply to marking time during function call
As usual: Show some relevant code. Everything else forces us to guess.
To find hot spots in your code, use Devel::NYTProf:
perl -dNYTProf yourscript.pl nytprofhtml --open [download]
Alexander