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,9fa5063fbdc75ae4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-17 12:48:43 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.nuthinbutnews.com!cyclone1.gnilink.net!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.clear.net.nz!news.clear.net.nz.POSTED!not-for-mail NNTP-Posting-Date: Fri, 17 Oct 2003 14:48:38 -0500 From: Craig Carey Newsgroups: comp.lang.ada Subject: Re: array of strings in a function Date: Sat, 18 Oct 2003 08:48:41 +1300 Message-ID: References: <8unsov8a3r9p02lm0ftkmmget77esc7fv7@4ax.com> X-Newsreader: Forte Agent 1.92/32.572 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Organization: Customer of Mercury Telecommunications Ltd Cache-Post-Path: drone5.qsi.net.nz!unknown@tnt1-207.quicksilver.net.nz X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) X-Original-NNTP-Posting-Host: drone5-svc-skyt.qsi.net.nz X-Original-Trace: 18 Oct 2003 08:48:47 +1300, drone5-svc-skyt.qsi.net.nz NNTP-Posting-Host: 203.97.37.6 X-Trace: sv3-5A1G3KVP3I3N/dHznnM78nwux05oSVJbTioqqdSNWSDw89mJt/APWsLJc3R3hZ/MWsjP9RDZVPgMBVd!VEhZBOmCwTU93hIB2/ZbYcNpercUBJzXhAkzICnb7P1bev6w7MJiFOXCqZrYYtj91zsefj+8feOh!NkbpViE= X-Complaints-To: Complaints to abuse@clear.net.nz X-DMCA-Complaints-To: Complaints to abuse@clear.net.nz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:1094 Date: 2003-10-18T08:48:41+13:00 List-Id: On Thu, 16 Oct 2003 21:44:16 +0000, Marius Amado Alves wrote: ... >I wrote a variant which allows a list of size 1 (something >Robert's doesn't), e.g. ... >with Ada.Strings.Unbounded; ... I timed some Ada 95 Strings packages. Ada 95 vendors are guided by the design of Ada and then their customers get faster code from the Internet. Here are the results of the test. SP Speed/Hz = 171560 1/12.5 : my no-strings array of pointers scheme SV Speed/Hz = 13760 1 : MAA with my Striunli strings MH Speed/Hz = 7750 1.77 : MAA with the Charles Container U. Strs SU Speed/Hz = 5880 2.3 : MAA with Ada 95's Unbounded Strings HR Speed/Hz = 1560 8.8 : MAA with the Adalog strings of Mr Rosen SB Speed/Hz = 1130 12 : MAA with Ada 95's Bounded Strings. "MAA" means the Ada code of the last message except that the max length for bounded strings is 4096 (which pulls down the ranking of Mr Rosen's Adalog strings package. Also the array of strings had 6 string components and not 1000 (that does not apply to SP). Bounded strings packages get slow fast as the max size increases. To change the max length from 4096 to 255 bytes, increased the speed of HR and SB to about 31500 Hz. In both cases the real data is 3 to 6 bytes long. The line of code being timed in loops, was like this: AV_Show (+"one" + "two" + "three" + "four" + "five" + "six"); (For the Charles (MH) test, pointer swapping was used. A function "in" mode parameter was changed using an unchecked conversion on an X'Address value.) For SB, Move and the Assign procedure, and for Striunli and Charles, the ":=" operator was properly avoided. More realistic tests can make GNAT's Unbounded Strings rank worse for the alternative package could be swapping pointers a lot. Another speed up for assigning is to have strings point to each other; and the package makes a minor attempt to catch some instances where the target unexpectedly changed. though it is supposed to be constant. It sounds like it could be a lot faster and it is up to the user to prove the correctness of the program. The strings package doesn't check fully. Craig Carey