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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-01 17:50:21 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!not-for-mail Message-ID: <3F7B7641.9030908@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? References: <3F7AC5B0.9080108@noplace.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 02 Oct 2003 00:50:21 GMT NNTP-Posting-Host: 165.247.68.145 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1065055821 165.247.68.145 (Wed, 01 Oct 2003 17:50:21 PDT) NNTP-Posting-Date: Wed, 01 Oct 2003 17:50:21 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:89 Date: 2003-10-02T00:50:21+00:00 List-Id: Really interesting, but not necessarily compeling. If all I'm basically after is some particular user input that I intend to store and/or process in some semi-insignificant way, a few extra miliseconds is probably unnoticable. ("I got your input. Thanks. I'll check it for validity and then go store it for you. See you later... Bye!") How is anybody going to know the difference? Maybe in some apps that are *really* heavy into string parsing, it might make a difference big enough to matter. (5 minutes per batch-compile versus 10 minutes per batch compile?) But usually - even in that case - the answer "buy a bigger computer" tends to be cheaper than "go make your programmers optimize it to save me some time..." I'm not saying you're wrong. Just that in most practical circumstances, nobody cares. Hence, the question: "Does anybody really need Bounded_String?" MDC tmoran@acm.org wrote: > > Liking numbers, I tried some timings on three different Ada compilers. > The results are all over the map. > > s1 : string(1 .. 10); > s2 : string(1 .. 100); > abs1 : bs1.bounded_string; -- length 10 > abs2 : bs2.bounded_string; -- length 100 > u : ada.strings.unbounded.unbounded_string; > test : constant string := "12345"; > cabs1 : bs1.bounded_string:=to_bounded_string(test); > cabs2 : bs2.bounded_string:=to_bounded_string(test); > cu : ada.strings.unbounded.unbounded_string:=to_unbounded_string(test); > > Each column represents a different compiler. The numbers are times for a > million iterations, divided by the total for that compiler, so each column > sums to the same value (within rounding). So the first row shows that > assigning a 5 character string to another 5 character string is among the > fastest things each compiler can do. Compiler A and C are at their > slowest doing "&" of unbounded strings, while B's slowest is "&" of > bounded strings. > > A B C > 0.01 0.01 0.01 s1(1 .. 5) := test > 0.01 0.00 0.01 s1(1 .. 5) := test; > 0.02 0.01 0.00 s2(1 .. 5) := test; > 0.20 1.86 0.25 abs1 := bs1.to_bounded_string(test); > 2.49 2.13 0.63 abs2 := bs2.to_bounded_string(test); > 1.98 3.25 7.69 u := ada.strings.unbounded.to_unbounded_string(test); > > 0.24 0.06 1.17 s1(1 .. 10) := s1(1 .. 5) & s1(1 .. 5); > 0.24 0.06 1.16 s2(1 .. 10) := s2(1 .. 5) & s2(1 .. 5); > 1.10 3.84 0.28 abs1 := cabs1 & cabs1; > 4.00 4.18 0.70 abs2 := cabs2 & cabs2; > 5.89 3.70 7.95 u := cu & cu; > > 0.01 0.01 0.00 if s1 = test then junk:=true;end if; > 0 0.00 0.00 if s2 = test then junk:=true;end if; > 0.31 0.04 0.08 if abs1 = test then junk:=true;end if; > 0.32 0.03 0.07 if abs2 = test then junk:=true;end if; > 0.31 0.05 0.09 if u = test then junk:=true;end if; > > 0.48 0.03 0.06 if abs1 = cabs1 then junk:=true;end if; > 0.54 0.03 0.06 if abs2 = cabs2 then junk:=true;end if; > 0.02 0.05 0.08 if u = cu then junk:=true;end if; > > 0.40 1.23 0.64 s1(1 .. 5) := slice(abs1,1,5); > 1.30 1.26 0.66 s1(1 .. 5) := slice(u,1,5); > 0.03 0.06 0.03 abs1 := cabs1; > 0.37 0.16 0.21 abs2 := cabs2; > 0.35 0.78 2.35 u := cu; > > 0.63 0.78 0.74 si:=index(s1,test); > 3.51 0.78 2.48 si:=index(s2,test); > 0.48 0.83 0.60 si:=index(abs1,test); > 0.48 0.82 0.62 si:=index(abs2,test); > 0.70 0.81 0.58 si:=index(u,test); > > 0.81 1.24 1.82 if length(u) < 100 then append(u,'x');else u := cu;end if; > 3.52 2.69 0.10 if length(abs2)<100 then append(abs2,'x');else abs2:=cabs2;end if; -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m c o n d i c @ a c m . o r g "All reformers, however strict their social conscience, live in houses just as big as they can pay for." --Logan Pearsall Smith ======================================================================