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 14:54:55 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news-hog.berkeley.edu!ucberkeley!tethys.csu.net!arclight.uoregon.edu!wn13feed!wn11feed!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc02.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? References: <3F7AC5B0.9080108@noplace.com> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.124.41 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc02 1065045294 12.234.124.41 (Wed, 01 Oct 2003 21:54:54 GMT) NNTP-Posting-Date: Wed, 01 Oct 2003 21:54:54 GMT Organization: Comcast Online Date: Wed, 01 Oct 2003 21:54:54 GMT Xref: archiver1.google.com comp.lang.ada:86 Date: 2003-10-01T21:54:54+00:00 List-Id: > I understand that Bounded_String has some technical advantages, but in > my experience, the instant I'm on a PC at some astronomical number of > megahertz/gigahertz with more memory than I can shake a stick at, > Unbounded_String and all its technical disadvantages compared to > Bounded_String just seem to not amount to a warm bucket of spit. Hence > I'm wondering if people actually have/do use it on anything like a > regular basis. 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;