Hello Haskellers,
I have been working through the Real World Haskell chapter on Profiling and Optimisation, and got to the section Advanced techniques: fusion, where I encountered some code using
Data.Array.Vectorfrom the deprecated libraryuvector.Does anyone know how to rewrite this to not use deprecated libraries?
I have tried to use
Data.Vector.Unboxedfromvector, but my version consumes a lot of memory.The code I have is here:
With that code, I get “1831 MB total memory in use”, which is terrible
Build run steps I used were:
stack build --executable-profiling --library-profiling --ghc-options="-fprof-auto -rtsopts -auto-all -caf-all -fforce-recomp" time /Users/jky/wrk/haskell-works/hw-tutorial-performance/.stack-work/install/x86_64-osx/lts-7.10/8.0.1/bin/hw-tutorial-performance-rwhe +RTS -sstderr -p -hy -RTS 1e7I get very large numbers of allocations of
PairandDouble.There is also a very large upfront allocation
ARR_WORDS, which I feared would happen when usingData.VectorAny help appreciated.
Cheers,
-John