4 ms·
>Haskell performance is very good when written by people who know how the compiler works I know nothing about how the compiler works, and my haskell code still
by imanaccount247 12y ago
>Haskell performance is very good when written by people who know how the compiler works
I know nothing about how the compiler works, and my haskell code still easily outperforms my clojure code. The only optimizations I do are the same as anywhere else: profile and look at functions taking up too much time.
>and know the bytecode they want generated.
Bytecode is not involved. Machine code is, but I don't even know ASM to know what I want generated or if it is being generated that way.
>When you need them, there is no real substitute for unboxed mutable arrays, something Haskell does NOT make easy.
This is simply nonsense. Unboxed mutable vectors are trivial in haskell: https://hackage.haskell.org/package/vector-0.10.11.0/docs/Data-Vector-Unboxed-Mutable.html https://hackage.haskell.org/package/vector-0.10.11.0/docs/Da... No, there is no substitute for using the right data types. Why do you think haskell or haskellers suggest using the wrong data types?
- yummyfajitas 12y agoMy goal is "as fast as C (TM)". Clojure is not known for being a speed demon. I didn't say you couldn't do arrays with Haskell, I said Haskell doesn't make it easy. Here are the actual array docs, BTW: http://www.haskell.org/haskellwiki/Arrays http://www.haskell.org/haskellwiki/Arrays
- zoomerang 12y agoOut of curiosity, what's difficult about that mutable array implementation? I'm a relative Haskell novice, but was able to write some mutable array code with only a cursory read through the documentation. Granted it's extremely verbose compared to most imperative languages.
- imanaccount247 12y ago>My goal is "as fast as C (TM)". Enjoy using C then. You suggested that haskell was bad because it was not fast enough. If "not as fast as C" is not fast enough, then virtually every language is not just bad, but much worse than haskell. >I said Haskell doesn't make it easy And I showed you that it is in fact trivially easy. >Here are the actual array docs, BTW That is a random, user-edited wiki page. I linked to the actual docs.
- yummyfajitas 12y agoIf "not as fast as C" is not fast enough, then virtually every language is not just bad, but much worse than haskell. I agree. The only languages I've used that are remotely competitive for my purposes are static JVM languages (Java and Scala), Ocaml, and Julia for array ops. Haskell comes closer than many others, but just isn't there yet. The docs you linked to are a 3'rd party package marked "experimental". I'll also suggest that you are glossing over most of the difficulties in using them. It's trivially easy to call `unsafeRead`. It's not so easy to wrap your operations in the appropriate monad, apply all the necessary strictness annotations to avoid thunks, and properly weave this monad with all the others you've got floating around. (That last bit is fairly important if you plan to write methods like `objectiveGradient dataPoint workArray`.)
- imanaccount247 12y ago>(Java and Scala), Ocaml, Except scala and ocaml are both slower than haskell. >The docs you linked to are a 3'rd party package marked "experimental". No it is not. What is the point of just outright lying? >I'll also suggest that you are glossing over most of the difficulties in using them I'll suggest that if you want people to believe your claim, then you should back it up. Show me the difficulty. Because my week 1 students have no trouble with it at all. >It's not so easy to wrap your operations in the appropriate monad You are literally saying "it is not easy to write code". That is like saying "printf" is hard in C because you have to write code. It makes absolutely no sense. Have you actually ever tried learning haskell much less using it? >apply all the necessary strictness annotations to avoid thunks All one of them? Which goes in the exact same place it always does? And which is not necessary at all? >and properly weave this monad with all the others you've got floating around. Ah, trolled me softly. Well done.
- yummyfajitas 12y agoI don't know why you are responding so angrily. The page you linked to explicitly says "Stability experimental" in the top right corner. I also don't know why you are behaving as if I dislike Haskell. I enjoy Haskell a lot, I just find getting very good performance to be difficult. You can browse my comment history to see a generally favorable opinion towards Haskell if you don't believe me. I also gave you a concrete example of a reasonable and necessary task I found difficult: specifically, numerical functions which need to mutate existing arrays rather than allocating new ones, e.g. gradient descent. Every time I've attempted to implement such things in Haskell, it takes me quite a bit of work to get the same performance that Scala/Java/Julia/C gives me out of the box (or Python after using Numba).