
Bertram Felgenhauer wrote:
Lyle Kopnicky wrote:
[snip]
listRecords :: AbsString s => TextTable s -> IO [TextRecord s] listRecords (TextTable fields _ records) = do keyRecs <- HT.toList records return $ map (fromList . zip fields . elems . snd) keyRecs
Doing fromList again and again can't be good. Why don't you make tableFields a map that maps names to array indices? Then you can just pass the bare arrays along, and the later lookups will be cheaper, too.
That might make a difference. It does spoil the interface a bit, since now the caller has to look up a field name to get an index, then use that to look up a value, instead of just using the field name to get the value.
Now due to lazyness this will probably be evaluated in matchscore, because before that the resulting Map isn't used. Which is exactly where you said a lot (most?) of the time is spent.
Yes, likely. I had to run on a small pair of files in order to get the profiling to work. So, probably more time was spent in matchScore than it admitted. (The overhead of the initial read would decrease as the table size increases.)
Another thing is that you should compile your code with -O, but I guess you are already doing that.
Yep. Thanks. - Lyle