[plt-scheme] (fast) reading of data files into a hash-table - how?

From: Chongkai Zhu (mathematica at citiz.net)
Date: Sat Dec 31 13:15:39 EST 2005

If your hash table doesn't needs any modification, edit a source file as:

(module a-hash-table mzscheme
  (provide a-hash-table)
  (define a-hash-table
     ;your data line by line here
     ;in assoc-list form

Then compile this file. Every time you need the hash-table, require the
compiled module.

Or if you need to dynamicly modify the hash table at some later time,
please try the hash table of SRFI 69 instead of the one build in PLT.
(I have already port SRFI 69 into PLT.) Use alist->hash-table instead
of make-immutable-hash-table in the module.

Chongkai Zhu

>I need to load a large amount of precomputed data.
>It is bassically a list of key:value pairs, where each key is a list
>of symbols and each value is a number. I have about 14000 such keys.
>I tried to just read the data line by line and put it into a
>hash-table, but it turns out creating a hash-table with 'equal, and
>then filling it with 14000 values takes way to much processing time.
>Is there any way to speed things up?

Posted on the users mailing list.