
Am Freitag 06 November 2009 18:19:50 schrieb Shawn Willden:
On Friday 06 November 2009 09:52:48 am Cory Knapp wrote:
Idiomatic Haskell won't be as fast as idiomatic C++, but it will blow Python away.
Based on the little bit of stuff I've done, I think I'd characterize it this way: C++ will be maybe twice as fast as Haskell. Maybe a little more, maybe a little less, depending on a lot of details.
Difficult waters. Depending on a lot of things, (rather idiomatic) Haskell is between a little faster (that's rare, however) and *much* slower than C (or C++, but I can only strongly advise against using that; pick C, C# or Java if you want to use a fast, halfway sensible imperative language. C++ consistently chose what I find the worst parts of both worlds - YMMV). Two things should be noted: - it's easy, especially if one isn't yet experienced, to write Haskell code that is much slower than C because of the wrong choice of data structures or not making things strict in the right places. - but if that happens, you have a good chance of quickly getting help to get up to speed here or on #haskell. That said, a factor of 2-3 relative to C is usually achievable without low-level tweaking, sometimes better, sometimes worse.
For heavy computation, Python will be a couple orders of magnitude slower than both.
For not very large values of 'couple': don't expect a factor of more than 100 - that's extremely rare.
IOW, Haskell is slower than C++ but it's in the same ballpark.
Yes, as a general rule, that's it.
Would anyone disagree?
Bulat?
Shawn.