Perl inefficiency...

Linda Walsh cygwin@tlinx.org
Wed Jan 24 21:08:00 GMT 2007


$a="a";          (uses 2 Bytes)
$a="a" * 100Meg; (uses 200MB)
$b="b" * 100Meg;
...

I may be reading this incorrectly, but I don't think the question
is why storage for the separate strings "$a", "$b" isn't freed, but
why would perl use 2 bytes/character?  I thought perl used UTF-8
internally(?).  Shouldn't it be using closer to 100MB to store
100-Million chars?

Of course if perl had a "use-less-memory" pragma, I might even
"hope" that it would store the above string as a repeat-count
followed by the string...but that would be expecting a bit...

I understand perl may not be as efficient in data storage as
C, but seems like expanding a 100MB string to take 200MB is
wasting 100MB. 

Is this what you were referring to, Corinna?

Linda




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list