Previous mail
Next mail
Formatted
Overview 10 days
Subject
Date
Thread
Author
From gpc-owner+M8228@gnu.de Mon Feb 15 18:27:09 2010
Received: from localhost ([127.0.0.1] helo=gnu.de)
by ngc224.gerwinski.de with smtp (Exim 4.50 #1 (Debian))
id 1Nh4hn-0003Gq-5Q; Mon, 15 Feb 2010 18:25:55 +0100
Received: from clara.unet.brandeis.edu ([129.64.99.165])
by ngc224.gerwinski.de with esmtp (Exim 4.50 #1 (Debian))
id 1Nh4hb-0003FC-Ly
for <gpc@gnu.de>; Mon, 15 Feb 2010 18:25:52 +0100
Received: from dyn-129-64-201-95.wireless.brandeis.edu (dyn-129-64-201-95.wireless.brandeis.edu [129.64.201.95])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested)
(Authenticated sender: hashemi)
by clara.unet.brandeis.edu (Postfix) with ESMTP id B96F2524C9
for <gpc@gnu.de>; Mon, 15 Feb 2010 12:25:42 -0500 (EST)
Message-ID: <4B79839E.5050109@brandeis.edu>
Date: Mon, 15 Feb 2010 12:25:50 -0500
From: Kevan Hashemi <hashemi@brandeis.edu>
Organization: Brandeis University
User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
MIME-Version: 1.0
To: gpc@gnu.de
Subject: Long String Generation
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
Precedence: bulk
Sender: gpc-owner@gnu.de
Dear GPC Users,
I use long strings to pass numerical data into and out of a shared
library I compile from Pascal. Right now, I generate a long string of
numbers like this.
program string_demo;
var
long_string:string(100000);
i:integer;
begin
long_string:='';
for i:=1 to 10000 do
writestr(long_string,long_string,i:1,' ');
end.
Clearly, this is inefficient. It takes 200 ms on my machine. If I use an
array of characters instead of a string, and append each new entry to
the array, execution time drops to 10 ms.
I can't see a way of using GPC's writestr, concat, or trim functions to
accelerate my string generation. I can't alter the long_string.length
field directly. If I could fill up the string with spaces first, I could
use the string as an array, then trim the spaces off the end. But
filling up the string with spaces requires multiple calls to writestr,
so I'm back where I started.
It seems to me that I'm missing an obvious solution to my problem, and I
thought you might point it out to me.
Yours, Kevan
--
Kevan Hashemi, Electrical Engineer
Physics Department, Brandeis University
http://alignment.hep.brandeis.edu/
Previous mail
Next mail
Formatted
Overview 10 days
Subject
Date
Thread
Author
Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.
Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.
This page was created by Crystal 0.999 (Linux 2.4.27/i686).