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

Re: Space Efficiency of Hashes

by Stevie-O (Friar)
on Mar 16, 2005 at 00:52 UTC ( #439830=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
    
    my $count = scalar keys %hash;
    print commas($count), " elements: ", commas(total_size\%hash), " bytes
    +\n";
    
  2. or download this
    1 elements: 176 bytes
    10 elements: 1,171 bytes
    ...
    10,000 elements: 1,135,573 bytes
    100,000 elements: 11,224,325 bytes
    1,000,000 elements: 111,194,341 bytes
    
  3. or download this
    $"=$,,$_=q>|\p4<6 8p<M/_|<('=>
    .q>.<4-KI<l|2$<6%s!<qn#F<>;$,
    .=pack'N*',"@{[unpack'C*',$_]
    }"for split/</;$_=$,,y[A-Z a-z]
             {}cd;print lc
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-08-18 19:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?