my versus our, why is my slower when script ends (global cleanup)by marioroy (Parson)
|on Apr 22, 2017 at 01:51 UTC ( #1188596=perlquestion: print w/replies, xml )||Need Help??|
marioroy has asked for the wisdom of the Perl Monks concerning the following question:
On Mac OS X and Linux (not tested on other Unix platforms), there appears to be extra overhead by Perl prior to the script exiting for variables declared with my. The extra time is noticeable after seeing the "end" output.
Why does Perl have this odd behavior during cleanup?
There is practically no delay after seeing "end" if I declare the variable with our.
I made a script to capture the running time, helpful on Windows. Unix has time command and shell builtin time.
Thank you, karlgoethebier for this enlightenment. I do not understand what Perl is doing during cleanup. Has anyone encountered this behavior? I tested on Windows and is nothing like seen on Mac OS X and Linux.
Back to Seekers of Perl Wisdom