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.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, UNCLOSED_BRACKET 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!news.glorb.com!news.netcologne.de!newsfeed-fusi.netcologne.de!151.189.20.20.MISMATCH!newsfeed.arcor.de!news.arcor.de!not-for-mail From: Albert Bachmann Subject: Re: Spellcheck.adb Date: Thu, 28 Apr 2005 01:58:59 +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: 28 Apr 2005 01:59:00 MEST NNTP-Posting-Host: 3c498eb0.newsread2.arcor-online.net X-Trace: DXC=TZ]5logTVb>GKQ1;SL\gZ1Q5U85hF6f;4jW\KbG]kaM8:cmYYm_h3\3O74nMMVR33?L@m@ojHhoY8 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