[Haskell-beginners] Testing a data structure, etc
Stephen Tetley
stephen.tetley at gmail.com
Sat Jun 19 10:43:32 EDT 2010
Hi Matthew
A quick one to reduce line width is to import qualified with a single
character alias:
import qualified Data.Map as M
Then the longest line becomes:
Nothing -> SequenceMap notP (M.insert a (insert as p empty) M.empty)
... saving 2x7 characters in this case.
As for performance always compile (never use GHCi) and always use -O2
otherwise rewrite-rules and other optimizations will not be used by
GHC.
When you run the executable, get the runtime system to print its stats:
./MyProg +RTS -sstderr -RTS
... This will print memory usage, garbage collection and timing stats.
For serious work there is also the Criterion bench-marking package.
Best wishes
Stephen
More information about the Beginners
mailing list