Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How does variable definition affect Perl performance ?

by wazoox (Prior)
on Dec 05, 2009 at 11:05 UTC ( [id://811222]=note: print w/replies, xml ) Need Help??


in reply to How does variable definition affect Perl performance ?

Aren't these variables global? As others said, initializing an empty variable should hardly matter; however setting to 0 a variable containing huge data can maybe take time.

  • Comment on Re: How does variable definition affect Perl performance ?

Replies are listed 'Best First'.
Re^2: How does variable definition affect Perl performance ?
by ikegami (Patriarch) on Dec 05, 2009 at 17:15 UTC

    setting to 0 a variable containing huge data can maybe take time.

    No. Why would assigning to a variable have to traverse the contained string? The length of the string contained doesn't matter. It's not even freed (which still wouldn't effect the time taken for long strings vs small strings).

    Or maybe you are talking about a scalar that contains the last reference to an object or a large structure? Destroying the structure can take time (e.g. if destructors need to be called), but I don't see the relevance. Destroying the structure will have to occur sooner or later. It's not going to speed up the OP's program by delaying when it occurs.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://811222]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-26 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found