Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: '%hash = ()' is slower than 'undef %hash'

by dave_the_m (Monsignor)
on May 18, 2018 at 12:37 UTC ( [id://1214844]=note: print w/replies, xml ) Need Help??


in reply to '%hash = ()' is slower than 'undef %hash'

For anything but small hashes, the total time will be dominated by the time to free all the hash elements (which uses the same code path for both methods). Other than that, the assign will generally have a slightly higher overhead as it has to create an empty list first. In perl 5.26.0, the actual list assign operator has been optimised so that it handles an empty RHS lists more efficiently.

Dave.

  • Comment on Re: '%hash = ()' is slower than 'undef %hash'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-23 20:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found