Rubinius For You - GoRuCo

  • 639 views
Uploaded on

Evan Phoenix' presentation at GoRuCo

Evan Phoenix' presentation at GoRuCo

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
639
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
7
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Rubinius For You @evanphx ♘ github.com/evanphx Evan Phoenix Jun 4th, 2011
  • 2. 2011The Year Rubinius Breaks Through
  • 3. Why Bother?
  • 4. Why Bother?We can have it better
  • 5. Why Bother?Not a single release, a philosophy
  • 6. Why Bother? Improve over time
  • 7. Why Bother? Improve Performance
  • 8. Why Bother? Improve Tooling
  • 9. Why Bother? Improve Developer Experience
  • 10. What’s Next?
  • 11. What’s Next? 2.0
  • 12. What’s Next? 2.0 Ruby 1.9 support
  • 13. What’s Next? 2.0 Concurrency
  • 14. What’s Next? 2.0 Microsoft Windows support
  • 15. Real World
  • 16. Real WorldWhen programs stop being polite and start getting real.
  • 17. Real WorldRubinius slower than it should be
  • 18. Real WorldProfiling is key to improving
  • 19. Real WorldProfiling is key to improving Example
  • 20. WARNING:SCIENCE AHEAD
  • 21. Problem:A method seems slow
  • 22. Improving Step 1
  • 23. Improving Step 1 Benchmark
  • 24. require benchmarkcc = CoworkersCode.newBenchmark.bm do |x| x.report("initial") { cc.calculate_awesome_score }end
  • 25. user system total realinitial 0.071788 0.001601 0.073389 ( 29.998823)
  • 26. user system total realinitial 0.071788 0.001601 0.073389 ( 29.998823)
  • 27. 29.998823
  • 28. user: 0.071788system: 0.001601 total: 0.073389 real: 29.998823
  • 29. UserTime running code
  • 30. SystemTime inside the kernel
  • 31. TotalSum of user and system
  • 32. RealElapsed wall clock
  • 33. Wall Clock Topic
  • 34. user: 0.071788system: 0.001601 total: 0.073389 real: 29.998823
  • 35. ??0.073389 !=29.998823
  • 36. Improving Step 2 Profile
  • 37. » rbx -Xprofile scratch/profile_sample.rb % cumulative self self total time seconds seconds calls ms/call ms/call name------------------------------------------------------------ 99.69 30.00 30.00 10 3000.10 3000.10 Rubinius::Channel#receive_timeout 0.13 0.04 0.04 2 19.82 19.82 IO.open_with_mode 0.11 0.03 0.03 1 33.05 33.05 IO::Buffer#fill 0.02 0.01 0.01 18 0.30 0.30 FFI::Platform::POSIX.stat
  • 38. » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb 0.00 30.00 10/60 Kernel#sleep [15][16] 99.9 30.00 0.00 10 Rubinius::Channel#receive_timeout [16] 0.00 30.00 10/20 CoworkersCode#superhero_factor [14][15] 99.9 0.00 30.00 10 Kernel#sleep [15] 30.00 0.00 10/10 Rubinius::Channel#receive_timeout [16]
  • 39. def superhero_factor sleep 3 rand(10)end
  • 40. Improving Step 3 Fix and benchmark
  • 41. user system total realinitial 0.000102 0.000047 0.000149 ( 0.000139)
  • 42. 0.000139
  • 43. 0.073389 !=29.998823
  • 44. Sleep!Invisible in all but real
  • 45. E D Problem:! O LVSA method seems slow
  • 46. Real WorldRubinius can tune your code itself
  • 47. Real WorldRubinius can tune your code itself Dynamic is not dynamic all the time
  • 48. “It’s ducks all the way down.” - Sandi Metz
  • 49. Real WorldRubinius can tune your code itself Most of yours quack the same though!
  • 50. def last_part(str) str.split(“ “).lastend
  • 51. def last_part(str) str.split(“ “).lastend
  • 52. 1: 25245 2: 275 3: 86 2 4: 50 1% 5: 35 6: 6 7: 10 8: 5 9: 5 10: 2 10+: 34 1 class 98%Call sites running Array specs
  • 53. Real WorldRubinius can tune your code itself Shoot first, let the VM sort it out.
  • 54. Real WorldMade for ruby applications
  • 55. Real WorldMade for ruby applications Ruby is objects
  • 56. Real WorldMade for ruby applications Rubinius is made for objects
  • 57. Real WorldMade for ruby applications Lots of objects
  • 58. “To optimize, I make sure not to create objects.” - Ryan Smith
  • 59. 1. 10,000,000 times a. Create 101 objects b. Save one of themhttps://gist.github.com/1008305
  • 60. mri 3000 2500 2000MBs 1500 1000 500 0
  • 61. 1. 10,000,000 times a. Create 101 objects b. Save one of themSaved objects: 10,000,000
  • 62. mri rbx 3000 2500 2000MBs 1500 1000 500 0
  • 63. mri rbx 300 250 200MBs 150 100 50 0
  • 64. mri rbx 70 58 47MBs 35 23 12 0 100k 200k 300k 400k
  • 65. Memory Time3,0002,250 5311,500 750 57 0 mri rbx
  • 66. Real WorldMade for ruby applications Love thy objects
  • 67. Next Steps
  • 68. Next StepsMore profiling, more tuning
  • 69. Next StepsNewer, smarter compiler
  • 70. Rubinius and You
  • 71. Rubinius and You Compatibly is there
  • 72. Rubinius and YouRubinius isn’t terrible for any workload
  • 73. Rubinius and YouRubinius is amazing for some
  • 74. Rubinius and You Try Rubinius!
  • 75. Rubinius and You Stickers in the back!
  • 76. Rubinius and You Shirts email us! community@rubini.us
  • 77. Rubinius Reward Use it in production => blog post about you
  • 78. Thanks!@evanphx ♘ github.com/evanphx Evan Phoenix Jun 4th, 2011
  • 79. Rubinius TechnologyEfficient Memory Layout
  • 80. obj.ivars = { :@name => “Evan”, :@age => 31}
  • 81. obj.class.ivars = { :@name => 0, :@age => 1} obj.ivars = [ “Evan”, 31 ]
  • 82. Flags ClassExtra Ivars @name @age