From: David Sauvage <pariakaman@gmail.com>
Subject: Re: [Shootout] Spellcheck.adb
Date: Tue, 26 Apr 2005 23:50:12 +0200
Date: 2005-04-26T23:50:12+02:00 [thread overview]
Message-ID: <nIybe.50781$Of5.32614@nntpserver.swip.net> (raw)
In-Reply-To: <4nm49tqq12fy.ucmt7m1938ld.dlg@40tude.net>
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
next prev parent reply other threads:[~2005-04-26 21:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-25 21:30 [Shootout] Spellcheck.adb albert.bachmann
2005-04-25 21:57 ` Spellcheck.adb Albert Bachmann
2005-04-25 23:27 ` [Shootout] Spellcheck.adb Marius Amado Alves
2005-04-26 18:04 ` Spellcheck.adb Matthew Heaney
2005-04-26 19:36 ` [Shootout] Spellcheck.adb David Sauvage
2005-04-26 20:50 ` Spellcheck.adb Albert Bachmann
2005-04-27 15:11 ` Spellcheck.adb Matthew Heaney
2005-04-27 22:49 ` Spellcheck.adb Albert Bachmann
2005-04-27 23:35 ` Spellcheck.adb Marius Amado Alves
2005-04-27 23:58 ` Spellcheck.adb Albert Bachmann
2005-04-28 0:19 ` Spellcheck.adb Marius Amado Alves
2005-04-29 10:22 ` Spellcheck.adb Albert Bachmann
2005-04-28 0:58 ` Spellcheck.adb Matthew Heaney
2005-04-29 10:19 ` Spellcheck.adb Albert Bachmann
2005-04-28 0:41 ` Spellcheck.adb Matthew Heaney
2005-04-28 21:20 ` Spellcheck.adb Simon Wright
2005-04-29 10:05 ` Spellcheck.adb Albert Bachmann
2005-04-29 12:35 ` Spellcheck.adb Matthew Heaney
2005-04-26 21:21 ` Spellcheck.adb Albert Bachmann
2005-04-26 22:04 ` Spellcheck.adb David Sauvage
2005-04-26 20:36 ` [Shootout] Spellcheck.adb Dmitry A. Kazakov
2005-04-26 21:50 ` David Sauvage [this message]
2005-04-27 8:40 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox