Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The future of Ruby is faster
Search
Dirkjan Bussink
June 29, 2013
Technology
3
530
The future of Ruby is faster
Talk given at Euruko 2013
Dirkjan Bussink
June 29, 2013
Tweet
Share
More Decks by Dirkjan Bussink
See All by Dirkjan Bussink
Managing a widely distributed team
dbussink
1
170
Time
dbussink
0
94
The tricky truth about parallel execution and modern hardware
dbussink
0
330
Security for dummies
dbussink
1
140
The myth of dynamic language performance
dbussink
3
420
Rubinius - Tales from the trenches @ Railsclub.ru 2012
dbussink
2
200
Rubinius - Tales from the trenches @ Baruco 2012
dbussink
1
250
Rubinius Eurucamp 2012 Workshop
dbussink
2
110
Rubinius Euruko 2012 Lightning talk
dbussink
2
230
Other Decks in Technology
See All in Technology
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
230
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
17
4.7k
.NET 9 のパフォーマンス改善
nenonaninu
0
1k
ガバメントクラウドのセキュリティ対策事例について
fujisawaryohei
0
560
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
32k
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
200
20241220_S3 tablesの使い方を検証してみた
handy
4
630
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
600
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
130
MLOps の現場から
asei
7
650
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
3
2.4k
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Writing Fast Ruby
sferik
628
61k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
What's in a price? How to price your products and services
michaelherold
243
12k
Visualization
eitanlees
146
15k
A better future with KSS
kneath
238
17k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
BBQ
matthewcrist
85
9.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
450
Transcript
The future of Ruby is faster Euruko 2013 Saturday, June
29, 13
Dirkjan Bussink @dbussink Saturday, June 29, 13
Rubinius Use Ruby Saturday, June 29, 13
Saturday, June 29, 13
Saturday, June 29, 13
“Everything you heard about Ruby being slow is not true.
It’s about twice as slow as that” Saturday, June 29, 13
Saturday, June 29, 13
The lure of the hash table Saturday, June 29, 13
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
class Address def initialize @instance_variables[:street] = "Pantheon" @instance_variables[:number] = 1
@instance_variables[:city] = "Athens" end end Saturday, June 29, 13
Hash tables everywhere! Saturday, June 29, 13
Inline caching Saturday, June 29, 13
p = Person.new p.name Saturday, June 29, 13
p = Person.new p.name <receiver_class_id, code> Saturday, June 29, 13
“There are 2 hard problems in computer science: caching, naming,
and off-by-1 errors” Saturday, June 29, 13
Global serial number Saturday, June 29, 13
http://jamesgolick.com/2013/4/14/mris-method-caches.html https://charlie.bz/blog/things-that-clear-rubys-method-cache Saturday, June 29, 13
Per class serial number Saturday, June 29, 13
Probably in 2.1 Saturday, June 29, 13
Instance variable packing Saturday, June 29, 13
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
0001: push_ivar :@number self[1] Removes hash table lookup Saturday, June
29, 13
Just in time compilation Saturday, June 29, 13
def method1 1 + method2 end def method2 2 +
1 end 100000.times do method1 end Saturday, June 29, 13
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
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
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
Saturday, June 29, 13
Creating less garbage Saturday, June 29, 13
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
Saturday, June 29, 13
2.1 Saturday, June 29, 13
Auto tuning Saturday, June 29, 13
Parallelism Saturday, June 29, 13
Higher throughput Saturday, June 29, 13
Concurrency Saturday, June 29, 13
Shorter stop the world Saturday, June 29, 13
thread 1 thread 2 thread 3 Saturday, June 29, 13
thread 1 thread 2 thread 3 GC thread Saturday, June
29, 13
thread 1 thread 2 thread 3 GC thread Long GC
pauses be gone! Saturday, June 29, 13
http://rubini.us/2013/06/22/concurrent-garbage-collection/ Saturday, June 29, 13
How much does it help? Saturday, June 29, 13
Before Saturday, June 29, 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 Saturday, June 29, 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
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
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
After Saturday, June 29, 13
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
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
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
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
1 client: 51 => 61 req/s 4 clients: 102 =>
176 req/s Saturday, June 29, 13
Concurrency & parallelism Saturday, June 29, 13
No GIL/GVL! Saturday, June 29, 13
Future is multi-core Saturday, June 29, 13
We need new API’s Saturday, June 29, 13
Parallel each Saturday, June 29, 13
Thread safe collections Saturday, June 29, 13
What about you as a developer? Saturday, June 29, 13
Be nice Saturday, June 29, 13
Write type stable code Saturday, June 29, 13
Small and simple methods Saturday, June 29, 13
Benchmark! Saturday, June 29, 13
? Saturday, June 29, 13