8. Speed penalty – Not always
Premature optimization
Fast and smart VM (JVM)
Bottleneck is somewhere else (DB)
You are not smart enough. Deal with it!
9. Cuby
Implemented in ~ 10 minutes
Looks like C
Feels like C
FULLY extensible
Trivial to add new libraries
You can use available Ruby libs
VM ~ 25 lines!
10. C in Ruby
Example
// this is a test (example.cb)
include ”stdio”
main {
printf ”Hello Mr. %s !”, ”Jon”
}
11. C in Ruby : Functions
Example
include ”stdio”
plea_for_merci_to name {
shout ”Please don't kill me” + name + ”!”
}
main {
plea_for_merci_to ”Jon”
}
13. Prediction Modelling
Lots of data (sometimes more than 60GB)
Long live C, Fortran, Lisp
Do you know OpenMP? If not, find another job
Speed, speed, speed
14. Predictions in Ruby?
RubyVM is not very robust (think BIG > 10GB)
Ruby is slow
Ruby threading is difficult and bad
Ruby does not SCALE!
19. OpenMP example
Example
#pragma omp parallel for
for (i = 0; i < arraySize; i++){
....
y[i] = sin( exp( cos( exp( sin(x[i]) ) ) ) );
....
}
20. Can we do this in Ruby?
Example
for j in 1..30
puts "Hello from iteration " + j.to_s
for i in 0..700000
c += a[i] * b[i]
end
puts "I have just finished!"
end
21. In Cuby we trust
Example
for j in 1..30
puts "Hello from iteration " + j.to_s
parallel {
for i in 0..700000
c += a[i] * b[i]
end
puts "I have just finished!"
}
end
22. Thank for watching! Questions?
Cuby available at:
http://github.com/jonromero/Cuby
http://jon.is.emotionull.com
jon@emotionull.com