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

The future of Ruby is faster

The future of Ruby is faster

Talk given at Euruko 2013

Dirkjan Bussink

June 29, 2013
Tweet

More Decks by Dirkjan Bussink

Other Decks in Technology

Transcript

  1. “Everything you heard about Ruby being slow is not true.

    It’s about twice as slow as that” Saturday, June 29, 13
  2. class MethodTable def initialize @methods = {} end def store_method(name,

    code) @methods[name] = code end def find_method(name) @methods[name] end end Saturday, June 29, 13
  3. class Address def initialize @instance_variables[:street] = "Pantheon" @instance_variables[:number] = 1

    @instance_variables[:city] = "Athens" end end Saturday, June 29, 13
  4. “There are 2 hard problems in computer science: caching, naming,

    and off-by-1 errors” Saturday, June 29, 13
  5. class Address def initialize @street = "Pantheon" @number = 1

    @city = "Athens" end end Address.instance_variable_get("@seen_ivars") => [:@street, :@number, :@city] Saturday, June 29, 13
  6. def method1 1 + method2 end def method2 2 +

    1 end 100000.times do method1 end Saturday, June 29, 13
  7. def method1 1 + method2 end def method2 2 +

    1 end 100000.times do method1 end ... 0x110ed90e7 mov $0x9, %eax 0x110ed90ec jmp 0x119 ; 0x110ed9129 ... 0x110ed9129 addq $0xa0, %rsp 0x110ed9130 pop %rbp 0x110ed9131 ret Saturday, June 29, 13
  8. def method1 1 + method2 end def method2 2 +

    1 end 100000.times do method1 end ... 0x110ed90e7 mov $0x9, %eax 0x110ed90ec jmp 0x119 ; 0x110ed9129 ... 0x110ed9129 addq $0xa0, %rsp 0x110ed9130 pop %rbp 0x110ed9131 ret b0100 (4) b1000 (8) b1001 (9) Saturday, June 29, 13
  9. def method1 1 + method2 end def method2 2 +

    1 end 100000.times do method1 end ... 0x110ed90e7 mov $0x9, %eax 0x110ed90ec jmp 0x119 ; 0x110ed9129 ... 0x110ed9129 addq $0xa0, %rsp 0x110ed9130 pop %rbp 0x110ed9131 ret b0100 (4) b1000 (8) b1001 (9) Saturday, June 29, 13
  10. a = Address.new a.street = "Pantheon" a.number = "1" a.city

    = "Athens" Rubinius.memory_size(a) => 56 VS Rubinius.memory_size(a) => 160 Saturday, June 29, 13
  11. thread 1 thread 2 thread 3 GC thread Long GC

    pauses be gone! Saturday, June 29, 13
  12. Lifting the server siege... done. Transactions: 501 hits Response time:

    0.02 secs Transaction rate: 51.70 trans/sec Throughput: 1.46 MB/sec Concurrency: 1.00 Longest transaction: 0.15 Shortest transaction: 0.01 Saturday, June 29, 13
  13. Lifting the server siege... done. Transactions: 501 hits Response time:

    0.02 secs Transaction rate: 51.70 trans/sec Throughput: 1.46 MB/sec Concurrency: 1.00 Longest transaction: 0.15 Shortest transaction: 0.01 Sad long wait time :( Saturday, June 29, 13
  14. Lifting the server siege... done. Transactions: 1032 hits Response time:

    0.04 secs Transaction rate: 102.79 trans/sec Throughput: 2.91 MB/sec Concurrency: 4.00 Longest transaction: 0.28 Shortest transaction: 0.02 Saturday, June 29, 13
  15. Lifting the server siege... done. Transactions: 1032 hits Response time:

    0.04 secs Transaction rate: 102.79 trans/sec Throughput: 2.91 MB/sec Concurrency: 4.00 Longest transaction: 0.28 Shortest transaction: 0.02 Not so good concurrency Saturday, June 29, 13
  16. Lifting the server siege... done. Transactions: 599 hits Response time:

    0.02 secs Transaction rate: 61.06 trans/sec Throughput: 1.73 MB/sec Concurrency: 1.00 Longest transaction: 0.03 Shortest transaction: 0.01 Saturday, June 29, 13
  17. Lifting the server siege... done. Transactions: 599 hits Response time:

    0.02 secs Transaction rate: 61.06 trans/sec Throughput: 1.73 MB/sec Concurrency: 1.00 Longest transaction: 0.03 Shortest transaction: 0.01 No more long pause! Saturday, June 29, 13
  18. Lifting the server siege... done. Transactions: 1374 hits Response time:

    0.02 secs Transaction rate: 176.38 trans/sec Throughput: 5.00 MB/sec Concurrency: 3.99 Longest transaction: 0.04 Shortest transaction: 0.01 Saturday, June 29, 13
  19. Lifting the server siege... done. Transactions: 1374 hits Response time:

    0.02 secs Transaction rate: 176.38 trans/sec Throughput: 5.00 MB/sec Concurrency: 3.99 Longest transaction: 0.04 Shortest transaction: 0.01 More req/s! Saturday, June 29, 13
  20. 1 client: 51 => 61 req/s 4 clients: 102 =>

    176 req/s Saturday, June 29, 13