[plt-scheme] (fast) reading of data files into a hash-table - how?
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
(make-immutable-hash-table
;your data line by line here
;in assoc-list form
'equal)))
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
>Hi,
>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?
>
>
>Thanks,
>Yoav