I have a list of words (182260 words, 1.6MB) that I need to read into
a series of hashes, e.g.
(word => true) for quick lookups,(word => (anagrams)), etc. Rather
than do this every time the program is run, I want to serialise the
hashes and dump them to a file, and subsequently loading in the file
if it exists.
However, a quick test:
;;;--------------------------------------------------------------------------------------
(define word-list (file->list "sowpods.txt"))
(define dict (make-hash-table))
(define (each-word proc) (for-each proc word-list))
(with-output-to-file "dict.s11n"
(lambda ()
(each-word
(lambda (word)
(hash-table-set! dict word #t)))
(serialize dict)))
;;;--------------------------------------------------------------------------------------
has spiked my cpu at 100% for the last several minutes, and seems to
be showing no signs of completing any time soon (it's taken a bit over
10 minutes to write out 600k of data).
Is there something I'm doing wrong, or some lighter way I can
serialise and deserialise the hash?
martin