Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Rubinius - What Have You Done For Me Lately

on

  • 2,461 views

Talk given at RubyConf 2010 in New Orleans by Evan Phoenix on Rubinius.

Talk given at RubyConf 2010 in New Orleans by Evan Phoenix on Rubinius.

Statistics

Views

Total Views
2,461
Views on SlideShare
2,461
Embed Views
0

Actions

Likes
1
Downloads
20
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 - What Have You Done For Me Lately Rubinius - What Have You Done For Me Lately Presentation Transcript

  • Tuesday, November 23, 2010
  • Rubinius What have you done for me today? Tuesday, November 23, 2010
  • Rubinius? Tuesday, November 23, 2010
  • Rubinius Modern Ruby Implementation Tuesday, November 23, 2010
  • Rubinius Philosophy Tuesday, November 23, 2010
  • Rubinius Philosophy Use Ruby Tuesday, November 23, 2010
  • Rubinius Philosophy Allow Ruby to extend the system Tuesday, November 23, 2010
  • module Enumerable def map if block_given? ary = [] each { |o| ary << yield(o) } ary else to_a end end end Tuesday, November 23, 2010
  • Rubinius Compatibility 1.8.7 Tuesday, November 23, 2010
  • Rubinius Compatibility Rails 2.3 - 3+ Tuesday, November 23, 2010
  • Rubinius Compatibility C extensions Tuesday, November 23, 2010
  • Rubinius Spin Off Projects Tuesday, November 23, 2010
  • Rubinius Spin Off Projects RubySpec Tuesday, November 23, 2010
  • Rubinius Spin Off Projects FFI Tuesday, November 23, 2010
  • Rubinius Drop In Compatible Tuesday, November 23, 2010
  • Rubinius Technology Tuesday, November 23, 2010
  • Rubinius Technology Bring techniques to Ruby Tuesday, November 23, 2010
  • Tuesday, November 23, 2010
  • Optimized to Machine Code Tuesday, November 23, 2010
  • Optimized to Machine Code Bytecode VM Tuesday, November 23, 2010
  • Optimized to Machine Code Bytecode VM Soph"ticated Garba# Collection Tuesday, November 23, 2010
  • Rubinius Technology Efficient Memory Layout Tuesday, November 23, 2010
  • obj.ivars = { :@name => “Evan”, :@age => 31 } Tuesday, November 23, 2010
  • obj.class.ivars = { :@name => 0, :@age => 1 } obj.ivars = [ “Evan”, 31 ] Tuesday, November 23, 2010
  • Flags Class Extra Ivars @name @age Tuesday, November 23, 2010
  • Developers! Tuesday, November 23, 2010
  • Developers! Developers! Tuesday, November 23, 2010
  • Developers! Developers! Developers! Tuesday, November 23, 2010
  • API Driven Build tools around APIs Tuesday, November 23, 2010
  • API Driven Allow users to build more! Tuesday, November 23, 2010
  • API Driven Example Bytecode Compiler Tuesday, November 23, 2010
  • API Driven Example Bytecode and Compiler Tuesday, November 23, 2010
  • API Driven Example Fancy Language Tuesday, November 23, 2010
  • Why use Rubinius? Tuesday, November 23, 2010
  • Why? Focus on Developers Tuesday, November 23, 2010
  • Why? I’m a Ruby developer Tuesday, November 23, 2010
  • Why? Tools born from need Tuesday, November 23, 2010
  • Problem: Improve an Algorithm Tuesday, November 23, 2010
  • Improving Step 1 Tuesday, November 23, 2010
  • Improving Step 1 Benchmark Tuesday, November 23, 2010
  • require 'benchmark' cc = CoworkersCode.new Benchmark.bm do |x| x.report("initial") { cc.calculate_awesome_score } end Tuesday, November 23, 2010
  • user system total real initial 0.071788 0.001601 0.073389 ( 29.998823) Tuesday, November 23, 2010
  • 29.998823 Tuesday, November 23, 2010
  • user system total real initial 0.071788 0.001601 0.073389 ( 29.998823) Tuesday, November 23, 2010
  • user: 0.071788 system: 0.001601 total: 0.073389 real: 29.998823 Tuesday, November 23, 2010
  • User Time running code Tuesday, November 23, 2010
  • System Time inside the kernel Tuesday, November 23, 2010
  • Total Sum of user and system Tuesday, November 23, 2010
  • Real Elapsed wall clock time Tuesday, November 23, 2010
  • Wall Clock Time measured by a stop watch Tuesday, November 23, 2010
  • user: 0.071788 system: 0.001601 total: 0.073389 real: 29.998823 Tuesday, November 23, 2010
  • 0.073389 != 29.998823 Tuesday, November 23, 2010
  • ?? 0.073389 != 29.998823 Tuesday, November 23, 2010
  • Improving Step 2 Profile Tuesday, November 23, 2010
  • » 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 Tuesday, November 23, 2010
  • » 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 Tuesday, November 23, 2010
  • » 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 Tuesday, November 23, 2010
  • » 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 Tuesday, November 23, 2010
  • » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb Tuesday, November 23, 2010
  • » rbx -Xprofile -Xprofiler.graph scratch/profile_sample.rb Tuesday, November 23, 2010
  • » 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] Tuesday, November 23, 2010
  • » 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] Tuesday, November 23, 2010
  • » 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] Tuesday, November 23, 2010
  • » 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] Tuesday, November 23, 2010
  • def superhero_factor sleep 3 rand(10) end Tuesday, November 23, 2010
  • def superhero_factor sleep 3 rand(10) end Tuesday, November 23, 2010
  • Improving Step 3 Fix and benchmark Tuesday, November 23, 2010
  • user system total real initial 0.000102 0.000047 0.000149 ( 0.000139) Tuesday, November 23, 2010
  • 0.000139 Tuesday, November 23, 2010
  • 0.000139 Tuesday, November 23, 2010
  • 0.073389 != 29.998823 Tuesday, November 23, 2010
  • Sleep! Invisible in all but real time Tuesday, November 23, 2010
  • Problem: Improve an Algorithm Tuesday, November 23, 2010
  • E D ! Problem: O LV S Improve an Algorithm Tuesday, November 23, 2010
  • Problem: Slow / hung process Tuesday, November 23, 2010
  • » bin/rbx scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • Problem: Slow / hung process Use Query Agent to inspect Tuesday, November 23, 2010
  • » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • » bin/rbx console VM: bin/rbx -Xagent.start scratch/qa_sample.rb Connecting to VM on port 58273 Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0 console> Tuesday, November 23, 2010
  • » bin/rbx console VM: bin/rbx -Xagent.start scratch/qa_sample.rb Connecting to VM on port 58273 Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0 console> pid PID: 39331 Tuesday, November 23, 2010
  • » bin/rbx -Xagent.start scratch/qa_sample.rb 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • » bin/rbx console VM: bin/rbx -Xagent.start scratch/qa_sample.rb Connecting to VM on port 58273 Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0 console> pid PID: 39331 console> backtrace Tuesday, November 23, 2010
  • » bin/rbx console VM: bin/rbx -Xagent.start scratch/qa_sample.rb Connecting to VM on port 58273 Connected to localhost:58273, host type: x86_64-apple-darwin10.4.0 console> pid PID: 39331 console> backtrace Thread 0: 0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72) 0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125) 0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx- release/scratch/qa_sample.rb:10 (+7) 0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/ scratch/qa_sample.rb:17 (+91) 0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/ codeloader.rb:67 (+44) 0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/ codeloader.rb:91 (+40) 0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125 0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64) 0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33) 0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60) Tuesday, November 23, 2010
  • Thread 0: 0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72) 0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125) 0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx- release/scratch/qa_sample.rb:10 (+7) 0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/ scratch/qa_sample.rb:17 (+91) 0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/ codeloader.rb:67 (+44) 0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/ codeloader.rb:91 (+40) 0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125 0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64) 0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33) 0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60) Tuesday, November 23, 2010
  • Thread 0: 0x7fff5fbfc250: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72) 0x7fff5fbfc690: IO#read in kernel/common/io.rb:1197 (+125) 0x7fff5fbfcaf0: ImportantServer#get_request in /Users/evan/git/rbx- release/scratch/qa_sample.rb:10 (+7) 0x7fff5fbfced0: MAIN.__script__ in /Users/evan/git/rbx-release/ scratch/qa_sample.rb:17 (+91) 0x7fff5fbfd390: Rubinius::CodeLoader#load_script in kernel/delta/ codeloader.rb:67 (+44) 0x7fff5fbfd790: Rubinius::CodeLoader.load_script in kernel/delta/ codeloader.rb:91 (+40) 0x7fff5fbfdbb0: Rubinius::Loader#script in kernel/loader.rb:467 (+125 0x7fff5fbfdfc0: Rubinius::Loader#main in kernel/loader.rb:578 (+64) 0x7fff5fbfe3e0: Rubinius::Loader.main in kernel/loader.rb:617 (+33) 0x7fff5fbfe800: Object#__script__ in kernel/loader.rb:628 (+60) Tuesday, November 23, 2010
  • Problem: Slow / hung process Sample process via CLI Tuesday, November 23, 2010
  • » bin/rbx -Xagent.start -Xagent.verbose scratch/qa_sample.rb [QA: Bound to port 58407] 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • » bin/rbx -Xagent.start -Xagent.verbose scratch/qa_sample.rb [QA: Bound to port 58407] 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • » bin/rbx -Xagent.start -Xagent.verbose scratch/qa_sample.rb [QA: Bound to port 58407] 1288125364.684678: Server started, pid 39331 Tuesday, November 23, 2010
  • » bin/rbx console -p 58431 --bt Thread 0: 0x7fff5fbfc200: IO::Buffer#fill_from in kernel/common/io.rb:67 (+72) 0x7fff5fbfc640: IO#read in kernel/common/io.rb:1197 (+125) 0x7fff5fbfcaa0: ImportantServer#get_request in /Users/evan/git/rbx- release/scratch/qa_sample.rb:10 (+7) 0x7fff5fbfce80: MAIN.__script__ in /Users/evan/git/rbx-release/ scratch/qa_sample.rb:17 (+91) 0x7fff5fbfd340: Rubinius::CodeLoader#load_script in kernel/delta/ codeloader.rb:67 (+44) 0x7fff5fbfd740: Rubinius::CodeLoader.load_script in kernel/delta/ codeloader.rb:91 (+40) 0x7fff5fbfdb60: Rubinius::Loader#script in kernel/loader.rb:467 (+125) 0x7fff5fbfdf70: Rubinius::Loader#main in kernel/loader.rb:578 (+64) 0x7fff5fbfe390: Rubinius::Loader.main in kernel/loader.rb:617 (+33) 0x7fff5fbfe7b0: Object#__script__ in kernel/loader.rb:628 (+60) Tuesday, November 23, 2010
  • Problem: Slow / hung process Easy API to build monitoring tools Tuesday, November 23, 2010
  • require 'socket' require 'rubinius/agent' port = 58431 agent = Rubinius::Agent.connect( "localhost", port) kind, bt = agent.get("system.backtrace") Tuesday, November 23, 2010
  • Query Agent Socket based VM API Tuesday, November 23, 2010
  • Query Agent Socket based VM API Simple get/set variables Tuesday, November 23, 2010
  • Problem: Slow / hung process Tuesday, November 23, 2010
  • E D ! Problem: O LV S Slow / hung process Tuesday, November 23, 2010
  • Problem: Memory Footprint Tuesday, November 23, 2010
  • Problem: Memory Footprint Suspect some kind of memory leak Tuesday, November 23, 2010
  • Problem: Memory Footprint Use Heap Dump! Tuesday, November 23, 2010
  • » bin/rbx -Xagent.start scratch/hd_demo.rb Waiting... Tuesday, November 23, 2010
  • » bin/rbx console VM: bin/rbx -Xagent.start scratch/hd_demo.rb Connecting to VM on port 58710 Connected to localhost:58710, host type: x86_64-apple-darwin10.4.0 console> set system.memory.dump heap.dump Tuesday, November 23, 2010
  • » bin/rbx -Xagent.start scratch/hd_demo.rb Waiting... Heap dumped to heap.dump Tuesday, November 23, 2010
  • » rbx -Ilib histo.rb ../rbx-release/heap.dump 19798 Rubinius::Tuple 3487912 4867 Rubinius::MethodTable::Bucket 272552 4218 String 303696 4193 Rubinius::CompiledMethod 805056 4193 Rubinius::InstructionSequence 134176 4110 Rubinius::ByteArray 100199256 1547 Rubinius::LookupTable::Bucket 74256 1053 Rubinius::LookupTable 50544 1010 Rubinius::MethodTable 48480 1000 BigCrazyClass 32000 966 Class 104592 783 Rubinius::StaticScope 37584 704 Rubinius::AccessVariable 56320 Tuesday, November 23, 2010
  • » rbx -Ilib histo.rb ../rbx-release/heap.dump 19798 Rubinius::Tuple 3487912 4867 Rubinius::MethodTable::Bucket 272552 4218 String 303696 4193 Rubinius::CompiledMethod 805056 4193 Rubinius::InstructionSequence 134176 4110 Rubinius::ByteArray 100199256 1547 Rubinius::LookupTable::Bucket 74256 1053 Rubinius::LookupTable 50544 1010 Rubinius::MethodTable 48480 1000 BigCrazyClass 32000 966 Class 104592 783 Rubinius::StaticScope 37584 704 Rubinius::AccessVariable 56320 Tuesday, November 23, 2010
  • Heap Dump Complete Heap Layout Tuesday, November 23, 2010
  • Heap Dump Complete Heap Layout Stable format Tuesday, November 23, 2010
  • Heap Dump Complete Heap Layout Reference Ruby Reader Tuesday, November 23, 2010
  • Heap Dump Gauge Tuesday, November 23, 2010
  • Heap Dump Gauge Rails Application Explorer Tuesday, November 23, 2010
  • Heap Dump Future Feature Tracking allocation sites Tuesday, November 23, 2010
  • Problem: Memory Footprint Tuesday, November 23, 2010
  • E D ! Problem: O LV S Memory Footprint Tuesday, November 23, 2010
  • Dy) Eostl ! Problem: O LV(m S Memory Footprint Tuesday, November 23, 2010
  • Future Tuesday, November 23, 2010
  • Future 1.9 Tuesday, November 23, 2010
  • Future Windows Tuesday, November 23, 2010
  • Future Full Concurrency Tuesday, November 23, 2010
  • Why Not? Tuesday, November 23, 2010
  • Thanks! Tuesday, November 23, 2010