5 ms·
"Do you have any evidence to suggest it is easier to write fast code in ocaml? I've never found a person who has used both languages and felt that was the case.
by talex5 13y ago
"Do you have any evidence to suggest it is easier to write fast code in ocaml? I've never found a person who has used both languages and felt that was the case. I've only found people without haskell experience believing that via second (or third, or fiftieth) hand rumors."
The first post in this blog series had a simple test (really just testing start-up time), where Haskell and OCaml were very similar. But in the second post (http://roscidus.com/blog/blog/2013/06/20/replacing-python-round-2/#speed http://roscidus.com/blog/blog/2013/06/20/replacing-python-ro...) with a slightly longer test-case, OCaml was twice as fast as Haskell.
- nousernamesleft 13y agoBut both were fast. And if he had enabled optimizations like it was suggested, the difference would be smaller. And if he had used attoparsec instead of a regex it would have been easier, less error prone, and faster. He literally didn't learn haskell and copy and pasted random stuff from stackoverflow and irc.
- lpw25 13y ago> He literally didn't learn haskell and copy and pasted random stuff from stackoverflow and irc But that's the point right. He did the same for OCaml and got faster code. Obviously you can write fast code in Haskell, but that is not the same as it being easy.
- nousernamesleft 13y ago>He did the same for OCaml and got faster code No he didn't. He took the time to learn ocaml. >Obviously you can write fast code in Haskell, but that is not the same as it being easy. The closest thing to evidence I can find suggests that it is no more difficult to write fast code in haskell: http://benchmarksgame.alioth.debian.org/u64/benchmark.php?test=all&lang=ghc&lang2=ocaml&data=u64 http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te...
- lpw25 13y ago> No he didn't. He took the time to learn ocaml. Not before writing his initial benchmarks, which is what we're talking about. > The closest thing to evidence I can find suggests that it is no more difficult to write fast code in haskell: > http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te.. http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te.... That measures ridiculous highly tuned implementations of the benchmarks, often written by the creators of the languages themselves. It contains absolutely no evidence of how hard it is to write fast programs in a language. Besides, I'm pretty sure citing the language shoot-out is an automatic disqualification in any argument about language speed.
- nousernamesleft 13y ago>Not before writing his initial benchmarks Yes, he did. Try talking to him. >That measures ridiculous highly tuned implementations of the benchmarks So, fast code. Which is what is at question. >It contains absolutely no evidence of how hard it is to write fast programs in a language. There is both lines of code, and actually looking at the code itself. Both of which make it appear that writing fast code is no more difficult in haskell than in ocaml. >I'm pretty sure citing the language shoot-out is an automatic disqualification in any argument about language speed. I'm pretty sure the language shoot-out is of greater value as evidence than personal anecdote is.
- lpw25 13y ago> So, fast code. Which is what is at question. No the question is about whether fast code is easy to write, if it has to be highly tuned then it is not easy to write. > I'm pretty sure the language shoot-out is of greater value as evidence than personal anecdote is. Actually, I think that the shoot-out causes a lot of harm to people's attempts to understand whether a language is fast or not. When people ask: "Is language X fast?" what they mean is "if I write my programs in it will they be fast". They do not mean "is the highly tuned code of an expert fast". The question of whether a language is fast is about whether code written in the natural idioms of the language is fast, not about whether you can coerce the compiler into producing the precise assembly code you are aiming for. If you are going to do that you might as well write the assembly code directly and call it using an FFI. Many implementations on the shoot-out bare no resemblance to the code people naturally write in those languages.