3. NMatrix
NMatrix is Sciruby’s numerical matrix core implemented for dense and sparse
matrices.
NMatrix on ATLAS/CBLAS/CLAPACK and standard LAPACK.
NMatrix for JRuby has been implemented using Apache Commons Math.
6. Benchmark
b = Java::double[15_000,15_000].new
c = Java::double[15_000,15_000].new
# b= Array.new(25000000)
index=0
puts Benchmark.measure{
(0...15000).each do |i|
(0...15000).each do |j|
b[i][j] = index
index+=1
end
end
}
index =0
puts Benchmark.measure{
(0...15000).each do |i|
(0...15000).each do |j|
c[i][j] = b[i][j]
index+=1
end
end
}
8. Chaining Java methods
Large Arrays.
Converting to two-d matrix from flat_array.
Coercion.
Each Fixnum object could be anywhere from 64 to 128 bytes in memory,
depending on the platform and how the JVM lays the objects out in memory.
So even on the low end, 100M numeric elements would be 6.4GB of objects.
And then the Array itself will be at least 100M * 4-8 bytes, or at least 400MB.
So there's at most 7.5GB difference from MRI.
10. Speed
Never upset the Garbage Collector.
Speed improved 1000times (from 25s to 0.022s) :).
11. Mixed-models
Mixed models are statistical models which predict the value of a response
variable as a result of fixed and random effects.
It is like a Ruby version of lme4 (an R package).
It has been successfully ported to JRuby too :) .