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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6c43f45c2ab47c51 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!y38g2000hsy.googlegroups.com!not-for-mail From: Gene Newsgroups: comp.lang.ada Subject: Re: Using Ada.Containers.Vector and Limited Private types Date: Sun, 13 Jul 2008 08:30:23 -0700 (PDT) Organization: http://groups.google.com Message-ID: <16cdae3f-83fa-4bd2-a9d1-3750518ff9d8@y38g2000hsy.googlegroups.com> References: <8ff4c6c2-9892-463e-bdfd-1f7bfd78d607@s50g2000hsb.googlegroups.com> <4c5bfeb0-daa0-45e4-82f0-eebabda565e9@d45g2000hsc.googlegroups.com> <6QQdk.194211$TT4.37376@attbi_s22> <940db060-ef08-4e1c-9556-0514181183eb@j22g2000hsf.googlegroups.com> <%BWdk.194588$TT4.100135@attbi_s22> NNTP-Posting-Host: 70.101.174.178 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1215963023 4468 127.0.0.1 (13 Jul 2008 15:30:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 13 Jul 2008 15:30:23 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y38g2000hsy.googlegroups.com; posting-host=70.101.174.178; posting-account=-BkjswoAAACC3NU8b6V8c50JQ2JBOs04 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:1135 Date: 2008-07-13T08:30:23-07:00 List-Id: On Jul 12, 12:41=A0am, "Jeffrey R. Carter" wrote: > Gene wrote: > > > Right. =A0I initially did it with UBS and changed it. Unbounded_String, > > at least in the GNAT implementation, is a super heavyweight. =A0In this > > case, you call Simple_Name to get a string and then convert it to an > > unbounded string. =A0In Ada 95 you'd have to convert back to a simple > > String for printing; fortunately that's fixed in 2005. =A0Nonetheless > > the syntax and the compiled code are both unsatisfying. =A0Barnes seems > > to agree: > > > ... conversion between bounded and unbounded strings and the raw type > > String is required rather a lot and is both ugly and inefficient. > > Premature optimization is the root of all evil. Well, evil for sure, but _all_ evil is a bit dramatic. ;-) I agree. It is nice that 2005 has a Text_IO variant for UBS. I had not realized that before this discussion. Thanks for making me read the LRM. In your little program, which > I am currently working on a large, soft-real-time system which makes exte= nsive > use of Unbounded_String and uses GNAT Pro; we have no problem meeting our= timing > requirements. You might want to be careful about this. I guess it depends how soft soft is. Internally it looks like GNAT ends up calling gcc malloc/free for UBS. Implementations of malloc/free can have wildly varying performance depending on current heap structure. Your app may meet time requirements today on test data and fail tomorrow because the heap has fragmented in a different way.