From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,966831d952eefbb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!193.252.118.146.MISMATCH!news.wanadoo.fr!news.wanadoo.fr!not-for-mail Sender: obry@PASCAL Newsgroups: comp.lang.ada Subject: Re: Random Input-Size and recognizing ENTER-press References: From: Pascal Obry Date: 19 Dec 2004 17:03:51 +0100 Message-ID: Organization: Home - http://www.obry.net User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 82.120.27.29 X-Trace: 1103472232 news.wanadoo.fr 11716 82.120.27.29:2387 X-Complaints-To: abuse@wanadoo.fr Xref: g2news1.google.com comp.lang.ada:7076 Date: 2004-12-19T17:03:51+01:00 List-Id: Jeffrey Carter writes: > You might want to take a look at the source for Ada.Strings.Unbounded from > GNAT before advocating an approach such as this. Every addition of a > Character allocates a new String, copies the old String + new Character into > the new String, and deallocates the old String. For a string of N > Characters, that's N allocations and deallocations. Using Get_Line to obtain > the Characters can improve that to N / Buffer'Length + 1. That's not right. There is a buffer that is allocated when there is no more space into an Unbounded_String. So there is far less that N allocation when adding N characters into an Unbounded_String. Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595