comp.lang.ada
 help / color / mirror / Atom feed
From: Albert Bachmann <albert.bachmann@gmx.de>
Subject: Re: Spellcheck.adb
Date: Fri, 29 Apr 2005 12:19:30 +0200
Date: 2005-04-29T12:19:31+02:00	[thread overview]
Message-ID: <pan.2005.04.29.10.19.30.67822@gmx.de> (raw)
In-Reply-To: ull73yax6.fsf@earthlink.net

On Thu, 28 Apr 2005 00:58:29 +0000, Matthew Heaney wrote:

> Albert Bachmann <albert.bachmann@gmx.de> writes:
> 
>> Yes. That's it. I should have known. And timing is not bad with hashed_set:
>> 
>> -- with custom hash function:
> 
> What is your custom hash algorithm?
> 

Just the one used in the C++ entry. With "custom" I just wanted to
distinguish it from Ada.Strings.Hash.

with ada.containers;
use  ada.containers;

function hash_function(key : string) return hash_type is
	n : hash_type := 0;
begin
	for i in key'range loop
		n := (n * 5 + character'pos(key(i)));
	end loop;

	return n;
end hash_function;

> 
>> -- with ada.strings.hash:
> 
> I just checked in Pascal Obry's improved algorithm for ada.strings.hash.
> See if it does any better on your input.
> 
> 
>> Using streams makes for another 10ms. But the GNAT.Spitbol.Table still
>> seems to be the fastest version so far.
> 
> What were those numbers again?
> 
> Regards,
> Matt

With David Sauvage's version (with uses GNAT.Spitbol.Table) I get the
following times:

real    0m0.074s
user    0m0.054s
sys     0m0.012s

I have no specific times for the streams version at hand since I deleted
it already. But I remember that back then the difference was in the range
of 10ms. Note that David Sauvage's version uses streams which contribute
to his excellent results.

http://charles.tigris.org/source/browse/charles/src/ai302/examples/spellcheck/
still shows only this initial revisions and the hash function there is the
same as the one I used.

Regards,
Albert




  reply	other threads:[~2005-04-29 10:19 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               ` Albert Bachmann [this message]
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
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