Difference between revisions of "How to profile a Haskell program"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | [[Category: |
+ | [[Category:Tutorials]] |
:''Just jotting down my notes whilst profiling one of my helper scripts. It would be great if the community could transform this into a tutorial'' |
:''Just jotting down my notes whilst profiling one of my helper scripts. It would be great if the community could transform this into a tutorial'' |
||
+ | |||
+ | == The case study == |
||
+ | |||
+ | I have a script that converts from an XML format to some pickled data structures via Data.Binary. The XML part is generated by HaXml's DtdToHaskell. On a 54M XML file, the thing swaps like crazy and takes several hours. I would like to improve the situation. |
||
+ | |||
+ | == Setting things up == |
||
+ | |||
+ | Get profiling versions of your libraries. For example, my script uses HaXmL, which uses a library called polyparse: |
||
+ | cd polyparse |
||
+ | runhaskell Setup.hs configure --enable-library-profiling |
||
+ | runhaskell Setup.hs build |
||
+ | sudo runhaskell Setup.hs install |
||
+ | cd .. |
||
+ | |||
+ | cd HaXml |
||
+ | runhaskell Setup.hs configure --enable-library-profiling |
||
+ | runhaskell Setup.hs build |
||
+ | sudo runhaskell Setup.hs install</pre> |
Revision as of 11:54, 20 March 2007
- Just jotting down my notes whilst profiling one of my helper scripts. It would be great if the community could transform this into a tutorial
The case study
I have a script that converts from an XML format to some pickled data structures via Data.Binary. The XML part is generated by HaXml's DtdToHaskell. On a 54M XML file, the thing swaps like crazy and takes several hours. I would like to improve the situation.
Setting things up
Get profiling versions of your libraries. For example, my script uses HaXmL, which uses a library called polyparse:
cd polyparse runhaskell Setup.hs configure --enable-library-profiling runhaskell Setup.hs build sudo runhaskell Setup.hs install cd ..
cd HaXml runhaskell Setup.hs configure --enable-library-profiling runhaskell Setup.hs build
sudo runhaskell Setup.hs install