My Haskell program takes too long to compile.
By that, I mean: It's been over a year since I've been able to compile with -O1. Last time I tried, I set up a 64gb server just to compile my program, and let it run overnight. It ran out of memory.
I'm about to embark on some big re-engineering changes which I hope will speed up compilation times, but first I need to know what's taking so long, and get some good measurements so I can track progress.
I currently have two ideas for how to do this:
stack build
that looks for lines like "[75 of 83] Compiling ," and times how long between them. (1) sounds really ugly, and I don't expect (2) to give good numbers because of imprecision and because of cross-module compilation. Anyone have better ideas?
Better and easier than watching text output, I realized I could simply look at the timestamps on files in the build folder.
This command gives me a nice list of build files sorted by timestamp, so I can roughly tell how long it spent on each:
ls -l -c -T -R .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/<source folder> | grep "rw" | grep "\." | awk '{print $8,$10}' | sort
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.