in reply to Re: Re: Re: Fast wordlist lookup for game
in thread Fast wordlist lookup for game
I've updated my original post to include the code I used to generate the index. So you can use that with your dictionary word list.
The 10,000 word document I used in my benchmark test was the output of `perldoc perltoot`.
I'm definitely interested in your results, unfortunately I've got some real work to do so I can't play right now. The main reason I posted a DBM solution was that many people are unaware of this middle ground between storing your data in a flat text file or using a full-blown RDBMS solution. One advantage is the shallow learning curve - if you can use a hash then with 3 more lines of code (use, tie, untie) then you can use a DBM solution. Another advantage is the blazing speed - the various DBM solutions are coded in highly optimised 'C' and use efficient indexing algorithms that can perform better than more general solutions used in RDBMS products.
I also had a rethink about one tie vs one tie per lookup. Assuming that the final solution was going to run under mod_perl, you probably would tie once when the script was first invoked. Kind of like using a persistent database connection with DBI. It would only be safe to keep the DBM file tied if it was not being written to. For the performance boost it would give, it might be worth batching any required updates and using the DBM file in readonly mode.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Fast wordlist lookup for game
by BrowserUk (Patriarch) on Oct 30, 2002 at 22:29 UTC | |
by grantm (Parson) on Oct 30, 2002 at 23:29 UTC |