After following the discussion I am not sure if the comparison is fair:

First, maybe the times measured may include some additional times that are
not directly related to the problem solved. For example the initialization
of the RTS.

Second, the C++ algorithm presented uses a permutation generator from the
C++ standard library. The times can only be compared, if both programs - the
C++  version and the Haskell version - use the same algorithm. It is easy to
speed up the Haskell version simply by using a permutation generator, that
starts with the solution. In general even this may be not sufficient,
because imperative and pure functional lazy evaluation of the same algorithm
may give very different results.

A fair comparison should include the best algorithm suitable for each
language and much more different inputs for the programs, including very
large ones.

Herbert Graeber




Reply via email to