Rubinius For You - GoRuCo
Upcoming SlideShare
Loading in...5
×
 

Rubinius For You - GoRuCo

on

  • 872 views

Evan Phoenix' presentation at GoRuCo

Evan Phoenix' presentation at GoRuCo

Statistics

Views

Total Views
872
Views on SlideShare
872
Embed Views
0

Actions

Likes
0
Downloads
7
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Rubinius For You - GoRuCo Rubinius For You - GoRuCo Presentation Transcript

  • Rubinius For You @evanphx ♘ github.com/evanphx Evan Phoenix Jun 4th, 2011
  • 2011The Year Rubinius Breaks Through
  • Why Bother? View slide
  • Why Bother?We can have it better View slide
  • Why Bother?Not a single release, a philosophy
  • Why Bother? Improve over time
  • Why Bother? Improve Performance
  • Why Bother? Improve Tooling
  • Why Bother? Improve Developer Experience
  • What’s Next?
  • What’s Next? 2.0
  • What’s Next? 2.0 Ruby 1.9 support
  • What’s Next? 2.0 Concurrency
  • What’s Next? 2.0 Microsoft Windows support
  • Real World
  • Real WorldWhen programs stop being polite and start getting real.
  • Real WorldRubinius slower than it should be
  • Real WorldProfiling is key to improving
  • Real WorldProfiling is key to improving Example
  • WARNING:SCIENCE AHEAD
  • Problem:A method seems slow
  • Improving Step 1
  • Improving Step 1 Benchmark
  • require benchmarkcc = CoworkersCode.newBenchmark.bm do |x| x.report("initial") { cc.calculate_awesome_score }end
  • user system total realinitial 0.071788 0.001601 0.073389 ( 29.998823)
  • user system total realinitial 0.071788 0.001601 0.073389 ( 29.998823)
  • 29.998823
  • user: 0.071788system: 0.001601 total: 0.073389 real: 29.998823
  • UserTime running code
  • SystemTime inside the kernel
  • TotalSum of user and system
  • RealElapsed wall clock
  • Wall Clock Topic
  • user: 0.071788system: 0.001601 total: 0.073389 real: 29.998823
  • ??0.073389 !=29.998823
  • Improving Step 2 Profile
  • » 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
  • » 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]
  • def superhero_factor sleep 3 rand(10)end
  • Improving Step 3 Fix and benchmark
  • user system total realinitial 0.000102 0.000047 0.000149 ( 0.000139)
  • 0.000139
  • 0.073389 !=29.998823
  • Sleep!Invisible in all but real
  • E D Problem:! O LVSA method seems slow
  • Real WorldRubinius can tune your code itself
  • Real WorldRubinius can tune your code itself Dynamic is not dynamic all the time
  • “It’s ducks all the way down.” - Sandi Metz
  • Real WorldRubinius can tune your code itself Most of yours quack the same though!
  • def last_part(str) str.split(“ “).lastend
  • def last_part(str) str.split(“ “).lastend
  • 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
  • Real WorldRubinius can tune your code itself Shoot first, let the VM sort it out.
  • Real WorldMade for ruby applications
  • Real WorldMade for ruby applications Ruby is objects
  • Real WorldMade for ruby applications Rubinius is made for objects
  • Real WorldMade for ruby applications Lots of objects
  • “To optimize, I make sure not to create objects.” - Ryan Smith
  • 1. 10,000,000 times a. Create 101 objects b. Save one of themhttps://gist.github.com/1008305
  • mri 3000 2500 2000MBs 1500 1000 500 0
  • 1. 10,000,000 times a. Create 101 objects b. Save one of themSaved objects: 10,000,000
  • mri rbx 3000 2500 2000MBs 1500 1000 500 0
  • mri rbx 300 250 200MBs 150 100 50 0
  • mri rbx 70 58 47MBs 35 23 12 0 100k 200k 300k 400k
  • Memory Time3,0002,250 5311,500 750 57 0 mri rbx
  • Real WorldMade for ruby applications Love thy objects
  • Next Steps
  • Next StepsMore profiling, more tuning
  • Next StepsNewer, smarter compiler
  • Rubinius and You
  • Rubinius and You Compatibly is there
  • Rubinius and YouRubinius isn’t terrible for any workload
  • Rubinius and YouRubinius is amazing for some
  • Rubinius and You Try Rubinius!
  • Rubinius and You Stickers in the back!
  • Rubinius and You Shirts email us! community@rubini.us
  • Rubinius Reward Use it in production => blog post about you
  • Thanks!@evanphx ♘ github.com/evanphx Evan Phoenix Jun 4th, 2011
  • Rubinius TechnologyEfficient Memory Layout
  • obj.ivars = { :@name => “Evan”, :@age => 31}
  • obj.class.ivars = { :@name => 0, :@age => 1} obj.ivars = [ “Evan”, 31 ]
  • Flags ClassExtra Ivars @name @age