3 ms·
I have a question about the CPU column: > 0% 0% 0% 100% This was a Quad Core CPU, so my first impulse is to ask, does that mean it was running on only one cor
by mr_luc 17y ago
I have a question about the CPU column:
> 0% 0% 0% 100%
This was a Quad Core CPU, so my first impulse is to ask, does that mean it was running on only one core?
- dfranke 17y agoYes. It was compiled with the threaded runtime, but the nature of the problem is such that all but one thread should be blocked at any given time, so the Haskell runtime scheduled them all on the same core.
- mr_luc 17y agoThat's pretty cool! Thanks for the informative response. Yeah, when I looked at the definition of the problem, it sort of made sense. Le sigh ... dammit, I should give Haskell more of my attention. I just hate camel casing and type errors :( And if I'm going to procrastinate about writing For Reals code in a language, various lisps have that covered already. Although, I'm writing a For Reals app in Ruby (w/merb) at the moment, and it's turning into a bit of an uggo. Maybe I'll procrastinate about finishing it, and give Haskell another go.
- dfranke 17y agoI hated static typing too until I learned Haskell. I dabbled in OCaml first and hated even that. Haskell and OCaml use the same basic paradigm for their type systems (Hindey-Milner), but Haskell's variant is more expressive. Typeclasses really made all the difference for me. Also, Haskell is just a really, really difficult language, and it's hard to pass accurate judgment until you've mastered it. When I first started studying Lisp, it took about six weeks of intense study before I really felt like I grokked the language. Coming into Haskell with my existing Lisp background, it took me a year to feel the same way.
- mr_luc 17y agoThat last paragraph is probably what I most needed to read. I did give The Haskell School of Expression a good whirl -- heh, I brought it down to south america with me, and hacked through a little of it each morning for a couple of months, swinging in a hammock and listening to waves crash and deciding that the water was probably still too cold to go out. But although I understood what I was reading and understood what the code I had written did ... grok I did not. I couldn't think creatively in Haskell AT. ALL. Nonetheless, your comment heartens me. Please reassure me further: are you a person who has ever written or attempted to write a non-trivial mathematic proof?
- gaius 17y agoYou'll notice they all add up to 100%... In this (artificial) test, only one thread is doing work at any time no matter on which core that thread is scheduled. I don't know if it was deliberate (i.e. a clever optimization) but if you're going to use your threads like that it makes sense, avoids cache misses.
- ryanpetrich 17y agoI wonder what sort of optimization Scala is employing ;)
- wglb 17y agoYou can tell by looking at the colums to the right--they show the load on each of the cores. What is particularly interesting is that Haskell uses only one CPU to beat Java which is using four.