Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Aloha Ruby Conf 2012: Message in a Bottle

5c2b452f6eea4a6d84c105ebd971d2a4?s=47 Konstantin Haase
October 10, 2012
1.8k

Aloha Ruby Conf 2012: Message in a Bottle

5c2b452f6eea4a6d84c105ebd971d2a4?s=128

Konstantin Haase

October 10, 2012
Tweet

Transcript

  1. MESSAGE IN A BOTTLE Konstantin Haase Aloha Ruby Conference October

    8, 2012
  2. Ruby 1.8 is slow because it's interpreted.

  3. Surprise! Ruby 1.9 is interpreted, too.

  4. THANKS

  5. @konstantinhaase (I’m sorry about that) rkh on github

  6. None
  7. None
  8. None
  9. None
  10. None
  11. None
  12. WWAPD

  13. Ruby

  14. Internals

  15. Performance

  16. None
  17. RubyMotion rupypy

  18. WHAT WE’LL LOOK INTO MRI: method dispatch and execution Rubinius:

    inline caches and JIT JRuby: invokedynamic
  19. None
  20. THEY JUST LOVE BYTECODE

  21. None
  22. MRI

  23. Rubinius

  24. JRuby (JVM 1.6)

  25. None
  26. Source Code Parser Parse Tree Interpreter Bytecode Compiler Bytecode Interpreter

    JIT Machine Code CPU VM
  27. THE PLAN Find Method Execute Method

  28. Performance

  29. HOW TO SPEED UP? Find Method Faster Execute Method Faster

  30. FIND FASTER Inline Cache (aka Call/ Send Site Cache) Lookup

    Cache Inlining
  31. EXECUTE FASTER Reduce operations Just-in-time compilation Speed up search

  32. None
  33. rb_method_entry rb_method_entry_without_cache search_method

  34. None
  35. None
  36. None
  37. None
  38. None
  39. None
  40. Module MethodTable Bucket CompiledCode

  41. None
  42. None
  43. None
  44. None
  45. InlineCache MachineCode CompiledCode initial_backend execute_backend cache_[cTrackedICHits] execute empty_cache ...

  46. None
  47. SPECIALIZED METHODS cached bytecode code with breakpoints specialized for arguments

    JITed code
  48. None
  49. None
  50. None
  51. None
  52. None
  53. None
  54. None
  55. Process invokedynamic JVM method bootstrap guard fallback

  56. None
  57. Reducing CPU instructions Reducing jumps Not breaking late binding

  58. caching inlining JITing guards

  59. FAST LOOKUP FAST EXECUTION

  60. THANKS