Performance difference between Linux and Windows?

I've been having a great deal of fun writing a program to solve this year's Code Jam "Fair and Square"problem in Haskell (and learning about Haskell in the process). Having gotten it to work, I've been optimizing it as best I can. I'm not quite in Captain Ahab mode, but before I let it go I would like to find out what's behind a difference I've seen compiling and running the program under Linux and under Windows 7. Profiling it under Linux (compiled with GHC 7.4.1), it had a total allocation of 165,375,112 bytes. I had an opportunity to compile and run on Windows 7, with GHC 7.4.2. I expected it to run faster, since the Windows computer had a 3.1 GHz i7 and my Linux computer has a 2.8 GHz AMD Propus, but what I didn't expect was that the total allocation on the Windows version was 88,438,372 bytes! Thinking it might be due to a compiler improvement, I upgraded my Linux computer to Ubuntu 13.04 so I could get a newer GHC, but it didn't make much difference: total allocation 163,248,688 bytes. So, I'm wondering: what is it about either the Windows implementation or GHC 7.4.2 in particular that would make a factor of two difference in memory allocation? Should anyone wish to compile the program, let me know the best way to make the source available and I will happily do so; I also use Twan van Laarhoven's semilattice search tree code available at http://twanvl.nl/blog/haskell/SemilatticeSearchTree. James Jones

The difference is roughly 2x, which suggests difference in Int/pointer
sizes: 32bit vs 64bit. Indeed, only since 7.6.1. GHC supports compiling 64
bit executables on Windows (
http://hackage.haskell.org/trac/ghc/wiki/WindowsGhc). That means that in
fact you compare 32 bit vs 64 bit programs.
I didn't have a look at the code so this is just a wild guess.
Best regards,
Krzysztof Skrzętnicki
On Fri, May 31, 2013 at 3:26 PM, James Jones
I've been having a great deal of fun writing a program to solve this year's Code Jam "Fair and Square"problem in Haskell (and learning about Haskell in the process). Having gotten it to work, I've been optimizing it as best I can. I'm not quite in Captain Ahab mode, but before I let it go I would like to find out what's behind a difference I've seen compiling and running the program under Linux and under Windows 7.
Profiling it under Linux (compiled with GHC 7.4.1), it had a total allocation of 165,375,112 bytes. I had an opportunity to compile and run on Windows 7, with GHC 7.4.2. I expected it to run faster, since the Windows computer had a 3.1 GHz i7 and my Linux computer has a 2.8 GHz AMD Propus, but what I didn't expect was that the total allocation on the Windows version was 88,438,372 bytes!
Thinking it might be due to a compiler improvement, I upgraded my Linux computer to Ubuntu 13.04 so I could get a newer GHC, but it didn't make much difference: total allocation 163,248,688 bytes.
So, I'm wondering: what is it about either the Windows implementation or GHC 7.4.2 in particular that would make a factor of two difference in memory allocation? Should anyone wish to compile the program, let me know the best way to make the source available and I will happily do so; I also use Twan van Laarhoven's semilattice search tree code available at http://twanvl.nl/blog/haskell/SemilatticeSearchTree.
James Jones
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
James Jones
-
Krzysztof Skrzętnicki