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,64b29dfa2220a59f X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!solaris.cc.vt.edu!news.vt.edu!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Reserve_Capacity for Unbounded_String? Date: Tue, 24 Jul 2007 19:41:55 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1185134043.892012.217560@n2g2000hse.googlegroups.com> <1185203238.701948.307410@m37g2000prh.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1185320515 5020 192.74.137.71 (24 Jul 2007 23:41:55 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 24 Jul 2007 23:41:55 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:BVDjVO45lT1rPoVRvpoUHgS6rdE= Xref: g2news2.google.com comp.lang.ada:1138 Date: 2007-07-24T19:41:55-04:00 List-Id: "Randy Brukardt" writes: > "Adam Beneschan" wrote in message > news:1185203238.701948.307410@m37g2000prh.googlegroups.com... > ... >> > Is this a reasonable approach if performance is of concern? >> >> I sure wouldn't count on this. > > I second (or is that "third") Adam and Jeff's comments. I said the opposite, but I guess I'm convinced by your (and Adam and Jeff's) arguments that one should not depend on this particular "efficiency hack". But... > For Janus/Ada, Unbounded_String is just a controlled wrapper around "access > String"; in particular, the length is the length of the item > allocated. Are you saying that: for I in 1..N loop Append (Some_Unbounded_String, 'x'); causes a free and a "new" and a copy every time around the loop? - Bob