Ruby’s Symbols Explained
Explain is a gem which can explain your Ruby code in natural language as shown below which works only with Rubinius.
The github page is at https://github.com/txus/explain.
Check the example below;
class Person
def walk(distance)
@distance += distance
@hunger += 2
end
end
Run explain on the code above
$ explain person.rb
Let’s describe the general attributes and behavior of any Person.
A Person can **walk**, given a specific distance. This is described as follows: its distance will be its distance plus what we previously defined as `distance`. Finally we return its hunger will be its hunger plus the number 2..
Way back in mid-2007, when Rails 1.2 was the new hotness and GitHub was still a year away from crawling out of the primordial internet soup, prolific open source contributor Dr Nic wrote an article titled “8 steps for fixing other people’s code”. It offers excellent general advice, but the…
A great article explaining a bit in depth of how Ruby code is translated to native machine code via JVM.
Some observation from the main article (read the article for more info):
- Java and Scala performance is pretty close.
- One would’ve imagined OO code to be generally the fastest due to minimal mutations or memory allocations. Yet that remains true only for the statically typed languages (and one notable exception PyPy). For all others, the list reduction approach is faster.
- jRuby consistently shows superior performance to Ruby 1.9.1. Coupled with further expected improvements arising out of invokedynamic in JDK 7, this is one runtime to watch. Though as the metrics show, it still has some ways to go to catch up.
- Its surprising to see clojure roughly similar to jRuby in performance.
Some good gems
Check your gems before switching over to jruby
p/s: thinking of trying jruby :)