Real World Haskell: Deprecated Libraries

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Real World Haskell: Deprecated Libraries

John Ky

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.Vector from the deprecated library uvector.

Does anyone know how to rewrite this to not use deprecated libraries?

I have tried to use Data.Vector.Unboxed from vector, but my version consumes a lot of memory.

The code I have is here:

https://github.com/haskell-works/hw-tutorial-performance/blob/master/hw-tutorial-performance-rwhe/Main.hs

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 1e7

I get very large numbers of allocations of Pair and Double.

There is also a very large upfront allocation ARR_WORDS, which I feared would happen when using Data.Vector

Any help appreciated.

Cheers,

-John


_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Real World Haskell: Deprecated Libraries

John Ky
It looks like Haskell stack's profile options are defeating stream fusion.

Anyone know a work-around?


On Mon, 28 Nov 2016 at 08:23 John Ky <[hidden email]> wrote:

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.Vector from the deprecated library uvector.

Does anyone know how to rewrite this to not use deprecated libraries?

I have tried to use Data.Vector.Unboxed from vector, but my version consumes a lot of memory.

The code I have is here:

https://github.com/haskell-works/hw-tutorial-performance/blob/master/hw-tutorial-performance-rwhe/Main.hs

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 1e7

I get very large numbers of allocations of Pair and Double.

There is also a very large upfront allocation ARR_WORDS, which I feared would happen when using Data.Vector

Any help appreciated.

Cheers,

-John


_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Real World Haskell: Deprecated Libraries

Bob Ippolito
Try using foldl', usually that's the right thing to do for this kind of data structure.

On Sun, Nov 27, 2016 at 2:39 PM, John Ky <[hidden email]> wrote:
It looks like Haskell stack's profile options are defeating stream fusion.

Anyone know a work-around?


On Mon, 28 Nov 2016 at 08:23 John Ky <[hidden email]> wrote:

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.Vector from the deprecated library uvector.

Does anyone know how to rewrite this to not use deprecated libraries?

I have tried to use Data.Vector.Unboxed from vector, but my version consumes a lot of memory.

The code I have is here:

https://github.com/haskell-works/hw-tutorial-performance/blob/master/hw-tutorial-performance-rwhe/Main.hs

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 1e7

I get very large numbers of allocations of Pair and Double.

There is also a very large upfront allocation ARR_WORDS, which I feared would happen when using Data.Vector

Any help appreciated.

Cheers,

-John


_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners