Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Strings and numbers: losing memory and mind.

by syphilis (Archbishop)
on Sep 28, 2007 at 08:32 UTC ( #641488=note: print w/replies, xml ) Need Help??


in reply to Strings and numbers: losing memory and mind.

Interesting post ... it prompted me to run the following:
use warnings; use Devel::Size qw(size); $str = "123"; $str += 0; # numify $str $num = int("123"); print size($str), " ", size($num), "\n";
On Win32 that outputs 32 16 (56 24 on a 64-bit build of perl). I guess that's a reliable way of determining the memory consumed by both $str (32 bytes) and $num (16 bytes). Zat right ?

Cheers,
Rob

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2023-05-31 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?