After profiling my haskell program, I’ve found that 66% of the time in the program is spent indexing into lists. The solution seems to be using Data.Vector, but I’m having trouble converting: when I change the code to use a Vector it uses tons and tons of memory, and hangs so badly I can’t even profile it. What could cause this?
Here is the file I would like to convert: https://github.com/drew-gross/Blokus-AI/blob/master/Grid.hs
and my attempt at converting it: https://github.com/drew-gross/Blokus-AI/blob/convert-to-vector/Grid.hs
Any ideas what I am doing wrong? Or at least, where to look?
That’s a killer right there.
fromListconverts an entire list to aVector, butrepeat defaultCellis an infinite list.or
would fix that.
A cursory look over the rest didn’t result in further obvious traps, but I may easily have overlooked some.