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,FREEMAIL_FROM autolearn=ham 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!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: Albert Bachmann Subject: Re: Spellcheck.adb Date: Fri, 29 Apr 2005 12:19:30 +0200 User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-ID: Newsgroups: comp.lang.ada References: <1114464642.518876.137610@f14g2000cwb.googlegroups.com> <1114548638.851249.246280@f14g2000cwb.googlegroups.com> <426fab8a$0$3712$39cecf19@news.twtelecom.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Organization: Arcor NNTP-Posting-Date: 29 Apr 2005 12:19:31 MEST NNTP-Posting-Host: e035e1cc.newsread4.arcor-online.net X-Trace: DXC=lOTaRMHXVjd0_l3b[L=KQc:ejgIfPPlddjW\KbG]kaMhliQbn6H@_EiKj]@Hm:g:3iV[]9NUANcngi^BfHUI;QCgHBB5X5Df;Ob X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:10808 Date: 2005-04-29T12:19:31+02:00 List-Id: On Thu, 28 Apr 2005 00:58:29 +0000, Matthew Heaney wrote: > Albert Bachmann 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