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,64fc02e079586f1b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.swip.net!swipnet!nntpserver.swip.net!not-for-mail From: David Sauvage User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050324 Debian/1.7.6-1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: [Shootout] Spellcheck.adb References: <1114464642.518876.137610@f14g2000cwb.googlegroups.com> <4nm49tqq12fy.ucmt7m1938ld.dlg@40tude.net> In-Reply-To: <4nm49tqq12fy.ucmt7m1938ld.dlg@40tude.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Tue, 26 Apr 2005 23:50:12 +0200 NNTP-Posting-Host: 83.177.237.209 X-Complaints-To: news-abuse@swip.net X-Trace: nntpserver.swip.net 1114552211 83.177.237.209 (Tue, 26 Apr 2005 23:50:11 MET DST) NNTP-Posting-Date: Tue, 26 Apr 2005 23:50:11 MET DST Organization: A Customer of Tele2 Xref: g2news1.google.com comp.lang.ada:10739 Date: 2005-04-26T23:50:12+02:00 List-Id: Dmitry A. Kazakov wrote: > ... > The above is approximately five times faster on my computer under FC3. > Probably, because it does not use hash tables? > GNAT.Spitbol.Table generic use hash tables (i wonder if it could be called an hashed table maps method?), may be people would like to have a look on it's hash function (see #1) The published shootout Ada spellcheck using GNAT.Spitbol.Table : real 0m0.120s user 0m0.083s sys 0m0.007s (i run all the programs several times before each post ;-), so i get fresh time average each post) I try using the Tables generic package implementation (see #2) instead of GNAT.Spitbol.Table generic on the shootout Ada spellcheck implementation, which gave me : real 0m0.271s user 0m0.197s sys 0m0.014s system configuration : Debian GNU/Linux Sid - kernel 2.6.10 - 1.2 Ghz gcc 3-3, GNAT 3.15p-12 #1 the GNAT.Spitbol.Table generic hash function ------------------------------------------------ (see g-spitbo.adb) function Hash (Str : String) return Unsigned_32 is Result : Unsigned_32 := Str'Length; begin for J in Str'Range loop Result := Rotate_Left (Result, 1) + Unsigned_32 (Character'Pos (Str (J))); end loop; return Result; end Hash; #2 The Tables generic package : ------------------------------- (see previous post) > [ http://www.dmitry-kazakov.de/ada/tables.htm ] David