4 ms·
> 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
by 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.
- nousernamesleft 13y agoYou could just look at the code instead of making up a strawman to try to dismiss the only evidence presented. Poor evidence > no evidence.
- lpw25 13y agoIt's not a strawman. Just look at the code for reverse-complement in Haskell. It is full of strictness annotations (unidiomatic) and uses inlinePerformIO (unsafe). It also uses a few inlining pragmas (unidiomatic). The fact that this code is fast tells you nothing about whether idiomatic Haskell is fast. wrong evidence < no evidence.
- nousernamesleft 13y agoYes, it is a strawman. Strictness annotations are not unidiomatic any more than using laziness is in ocaml. The ocaml code is effectively using unsafePerformIO all over, ocaml doesn't offer the safety you are complaining that the haskell example gives up. And both of your invalid complaints are completely irrelevant to the question at hand. The question was about difficulty, not a subjective idea of what idiomatic code looks like. Are you seriously claiming that the average haskell example there is more difficult to write than the average ocaml example? If so, just say that. Trying to redirect the discussion back to your subjective preferences is not productive.
- lpw25 13y agoNote that using `unsafePerformIO` is more unsafe than that, because the compiler assumes that functions are pure and will make transformations which alter the semantics in the presence of side effects. The OCaml compiler does not do these optimisations because it has to assume everything is impure. And `inlinePerformIO` is much more unsafe, because it requires that you do no memory allocation inside it. This property is specific to the Haskell implementation, and is certainly not easy to guarantee.
- codygman 13y agoStrictness annotations are idiomatic in Haskell.