13 / 13
Aug 2015

GHC's optimizer has gotten much better than it was way back in version 6.10.4. Furthermore, a number of its pragmas, options, etc., have changed substantially since then, so it's a bit hard to develop code for your judge's compiler.

By the way, I see that someone else made the same request last year, but it hasn't been upgraded since.

Example: inserting the pragma {-# OPTIONS -O2 -with-rtsopts=-m200000000 #-} drops my runtime on STRCOUNT down to as little as three milliseconds on my system. SPOJ's ancient version of GHC doesn't support -with-rtsopts, and also doesn't optimize so well, so my runtime is 0.05-0.07 seconds.

1 month later

Request seconded!

Please upgrade GHC to the latest version. The currently installed 6.10.4 was released in July 2009. Please install one of the versions released this year - 7.4.1 or 7.4.2. Latest compiler optimisations should make more problems solvable in Haskell under similar time constraints.

Could you also please publish the optimisation levels used during compilation, so that the similar performance behaviour is reproducible on user machines? IMHO, at least optimisation level -O1 should be enabled.

8 months later
3 months later

Fourth request. Haskel GHC 7.6.4 is out, the current version is more than 4 years old. Yes, the current Haskell is fast, but you can easily struggle when a particular function is much slower in this old version (and you can't rewrite it).

9 months later

Fifth request! Almost a year later...

Some commonly used functions in data structures (Data.Map, Data.Set) are missing and there seems to be no support for fast 64-bit integers.
Workarounds like using arbitrary precision Integer or Word64/Int64 are big impact on performance.

I didn't even try using Data.Text or anything similar to improve IO performance but I guess there would be a problem with that too.

2 months later

Sixth! GHC 6.10 is way too old, it doesn't have several import features like Data.ByteString.Builder (without this doing output is painful, such as the TSORT problem, which produces tons of output); Data.Vector (A much better choice over Data.Array), Also I think GHC 6.10 isn't doing well with Fusion (though I'm no haskell expert), so it runs much slower compare the recent GHC (7.8.3). Not to mention there lots of incompatibilities between GHC 6.10 & GHC 7.6+, such as Data.Map/Data.Set, the interfaces changed so much that I have to get about 5-10 CEs if I have to use some methods from them.

I wrote a Haskell version of NFACTOR, it takes 16.XX seconds to finish, while C++ version with takes about 1.6 seconds, But on by local machine C++ version is only about 2 times faster (I believe if I choose Unboxed vector instead of Array haskell version could be even the same as C++ version), both with 1MB lines of input data size. Another example is problem FACTCG2, I'm not sure it's even possible with GHC 6.10 (I got many TLEs while same algorithm in C++ can pass easily).

Personally I strongly pose to Haskell than other programming language, but it's really painful to submit a solution for GHC 6.10 and sometimes it's almost impossible. It will be really nice if SPOJ can have Haskell platform 2014.2 installed, though I'm not sure if someone really look into this at all -_-.

3 months later

Finally, updated, thanks a lot guys!
Although, it seems everything is updated, which is also nice for those eager to use c++14 features smiley

5 months later

Again it seems only GHC is installed, instead of haskell-platform. without haskell-platform it somehow using c++ without stl, which is very frustrating.

prog.hs:4:18:
Could not find module `Data.Vector.Unboxed'
Perhaps you meant Data.Functor (from base)
Use -v to see a list of the files searched for.

Get haskell-platform instealled instead, plz..

2 months later

closed Aug 28, '15

archived Aug 28, '15

archived Aug 28, '15