delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/24/16:09:10

X-Spam-Check-By: sourceware.org
Message-ID: <45B7CADC.4050502@tlinx.org>
Date: Wed, 24 Jan 2007 13:08:44 -0800
From: Linda Walsh <cygwin AT tlinx DOT org>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Perl inefficiency...
References: <20070122181727 DOT GC27843 AT calimero DOT vinschen DOT de> <1552 DOT 67 DOT 40 DOT 28 DOT 188 DOT 1169493973 DOT squirrel AT 67 DOT 40 DOT 28 DOT 188> <20070122202137 DOT GC20665 AT calimero DOT vinschen DOT de> <3593 DOT 67 DOT 40 DOT 28 DOT 188 DOT 1169584799 DOT squirrel AT 67 DOT 40 DOT 28 DOT 188> <20070124100540 DOT GP27843 AT calimero DOT vinschen DOT de>
In-Reply-To: <20070124100540.GP27843@calimero.vinschen.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

$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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019