<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Bertram Felgenhauer wrote:
<blockquote cite="mid20060927024941.GA10623@zombie.inf.tu-dresden.de"
 type="cite">
  <pre wrap="">Lyle Kopnicky wrote:
  </pre>
  <pre wrap="">[snip]
  </pre>
  <blockquote type="cite">
    <pre wrap="">listRecords :: AbsString s =&gt; TextTable s -&gt; IO [TextRecord s]
listRecords (TextTable fields _ records) = do
  keyRecs &lt;- HT.toList records
  return $ map (fromList . zip fields . elems . snd) keyRecs
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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.
  </pre>
</blockquote>
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.<br>
<blockquote cite="mid20060927024941.GA10623@zombie.inf.tu-dresden.de"
 type="cite">
  <pre wrap="">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.
  </pre>
</blockquote>
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.)<br>
<blockquote cite="mid20060927024941.GA10623@zombie.inf.tu-dresden.de"
 type="cite">
  <pre wrap="">Another thing is that you should compile your code with -O, but I guess
you are already doing that.

  </pre>
</blockquote>
Yep. Thanks.<br>
<br>
- Lyle<br>
</body>
</html>