MESSAGE INA BOTTLEKonstantin HaaseRuby LugdunumJune 23, 2012
View Slide
@konstantinhaase(I’m sorry about that)rkh on github
SinatraRack, Tilt, Rubinius, ...
Ruby 1.8 is slow because it'sinterpreted.
Surprise!Ruby 1.9 is interpreted, too.
THANKS
Ruby
Internals
Performance
RubyMotion
WHAT WE’LLLOOK INTOMRI: method dispatch and executionRubinius: inline caches and JITJRuby: invokedynamic
THEY JUST LOVEBYTECODE
MRI
Rubinius
JRuby (JVM 1.6)
Source CodeParserParse TreeInterpreter Bytecode CompilerBytecodeInterpreter JITMachine CodeCPUVM
THE PLANFind MethodExecute Method
HOW TOSPEED UP?Find Method FasterExecute Method Faster
FINDFASTERInline Cache (aka Call/Send Site Cache)Lookup CacheInlining
EXECUTEFASTERReduce operationsJust-in-time compilationSpeed up search
rb_method_entryrb_method_entry_without_cachesearch_method
SPECIALIZEDMETHODScached bytecodecode with breakpointsspecialized for argumentsJITed code
ProcessinvokedynamicJVM methodbootstrap guard fallback