4 ms·
I have no idea what is heavily optimized about that Haskell code. I am no Haskell expert, but all you did was use an unboxed array. I added one strictness annot
by mej10 14y ago
I have no idea what is heavily optimized about that Haskell code. I am no Haskell expert, but all you did was use an unboxed array. I added one strictness annotation to the "v" parameter on your iter function and it reduced the time from 10 seconds to 1.5 on my laptop.
None of the other code you wrote uses a linked list, so I don't know why you used them for Haskell. You used vector types for most of them (which Haskell has, by the way). Pretty disingenuous.
I admit that the prominent use of lists in newbie Haskell tutorials could have mislead you, but you seem to know the difference in data types since you used vectors everywhere else.
- postfuturist 14y agoThis is my first Haskell code, so I read several sources, and posted my code to some online sources asking for help. That's what I came up with. I tried a bunch of strictness hints, I found one that cut the time in half. Lots of trial and error. Apparently, there's another one I didn't find. Could you submit a pull request?
- postfuturist 14y agoWhy did you accuse me of being disingenuous? I used an Array (life-array.hs), if Haskell implements Arrays as a linked list... well, that's a problem.
- mej10 14y agoI accused you of that, because it seemed like you knew what you were doing with the other implementations, and then just suddenly forgot data structure performance when you got to Haskell. It was an asshole move, and I am sorry. They aren't linked lists, but you still used a linked list internal to your "iter" function, where you used a vector (or array) there in other implementations.