chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] lighter weight alternatives to s11n?


From: Martin DeMello
Subject: [Chicken-users] lighter weight alternatives to s11n?
Date: Sun, 1 Jul 2007 23:43:47 +0530

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]