Lessons Learned in Large Computations with Ruby
nirvdrum.com
nirvdrum.com
Acquire a C program, a C-Assembler program if possible and drive it from Ruby with an API.
Don't do mad cranking with Ruby.
Although, at a 100x productivity increase, I might have to give it another look; I'd be out of grad school by Halloween.
*For the uninitiated, Monte Carlo is a fancy way of saying "for loops."
This lets you do the complicated, high-level stuff in a language suited for it, and do the nitty-gritty stuff in C or your favorite compiled language.
It's very important to pick the right tool for the job, and these days that doesn't even have to be one tool at a time.
There are those that prefer to use MRI or YARV with C, and more power to 'em. However, I'm getting too old and lazy to spend all my time chasing down memory bugs.
He has a problem with execution speed and blames the tool instead of using the correct tool for the job. I could probably hammer a nail in with the back of a screwdriver but it would be better to learn how to use the hammer. Sigh. Call C from ruby/python/any interpreted language if you NEED speed.
Uh, why the negativity? Basically he is saying that Ruby is not well suited to certain tasks. How does that differ from what you say?
Increasingly, I'm unclear on what this unique advantage is that Ruby supposedly has that makes up for the atrocious implementation.
Sometimes you don't see how bad a tool is until you push it's limits, and I'd say that's just what he did. To use your analogy, I can buy a $2 screwdriver that works fine in many cases, but the shaft might snap or bend if I apply too much torque to it (and no nails in sight).
Some people like OO, some people like FP. Some people like things explicit, some people want things inferred.
All these popular languages are built around various trade offs. As I understand it, the functional languages allow you to use FP for your high-level stuff, but tend to be a bit slower than C (like one order of magnitude). Ruby has a lot of flexibility and allows for rapid development, but can be very slow for some things. C is fast, but it's C.
Get what I mean? Try a few. Find a language that works the way you think.
I think there is a fundamental reason why languages with dynamic types will usually be slower than languages with static types, but some statically typed languages should be able to compete in terms of speed?
I suppose that puts Scala and Haskell on the map. I am not a 100% sure about LISP - I think there are variants where static types are optional?
Nitpicking aside, let's assume "pleasant to use" means "deemed cool by the HN crowd". Just give me some suggestions, then I can still decide if I agree or not.
Edit: in the flawed language shootout, Haskell seems to kick ass: http://shootout.alioth.debian.org/gp4/benchmark.php?test=all...
I guess learning Haskell just moved up several steps on my TODO heap.
You'll usually see C, C++, Java, Haskell, OCaml, Fortran, Scala, and Lisp in the 1-10x range (of the fastest solution). They all should be reasonably competative on most things, and so you might make your decision based on personal preference and available libraries.
This is in contrast to things like Ruby, Perl, and Python which are often take 100x the time.
Interestingly, Erlang and Lua seem to consistently come out a bit ahead of almost everything else that's not compiled to native code, running on a JITing VM, and/or Lisp.
Please choose the up-to-date measurements instead of these.
http://shootout.alioth.debian.org/gp4/
you'll see an "UP-TO-DATE MEASUREMENTS" urlDo you think those labeled "22 Sep 2009" are more up to date than those labeled "mid 2008" or "late 2007"?
I've got a friend who works on simulating air currents around areroplanes real-time. They have to do everything in Fortran but he says that Fortran-99 is actually pretty pleasant. Pretty pleasant compared to older fortrans perhaps :)
Personally I get the best results from the MLton SML compiler. OCaml is also pretty fast and more practical. YMMV.
http://shootout.alioth.debian.org/u32/lua.php
http://shootout.alioth.debian.org/u32/benchmark.php?test=all...
http://xach.livejournal.com/199225.html
http://www.lrde.epita.fr/~didier/research/verna.06.imecs.pdf
http://www.lrde.epita.fr/~didier/research/verna.06.labri-sli...
http://shootout.alioth.debian.org/u32q/benchmark.php?test=al...