comp.lang.ada
 help / color / mirror / Atom feed
From: Albert Bachmann <albert.bachmann@gmx.de>
Subject: Re: Spellcheck.adb
Date: Thu, 28 Apr 2005 01:58:59 +0200
Date: 2005-04-28T01:59:00+02:00	[thread overview]
Message-ID: <pan.2005.04.27.23.58.58.919174@gmx.de> (raw)
In-Reply-To: mailman.91.1114644955.24457.comp.lang.ada@ada-france.org

On Thu, 28 Apr 2005 00:35:21 +0100, Marius Amado Alves wrote:

>> 	...
>> 	while not text_io.end_of_file(file) loop
>> 		text_io.get_line(file, item, item_offset);
>> 		hashed_set.insert(dict, item);
> 
> Don't pass the whole item, but the slice item (1 .. item_offset).
> 
>> ...
>> 	while not text_io.end_of_file loop
>> 		text_io.get_line(item, item_offset);
>> 		if not hashed_set.contains(dict, item) then
>> 			text_io.put_line(item);
>>
> 
> Ditto.
> 
> (And item_offset should be called item_length or similar.)

Yes. That's it. I should have known. And timing is not bad with hashed_set:

-- with custom hash function:
real    0m0.119s
user    0m0.101s
sys     0m0.009s

-- with ada.strings.hash:
real    0m0.130s
user    0m0.116s
sys     0m0.005s

Using streams makes for another 10ms. But the GNAT.Spitbol.Table
still seems to be the fastest version so far.

Regards,
Albert




  reply	other threads:[~2005-04-27 23:58 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           ` Albert Bachmann [this message]
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
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