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
竝行
Search
さっちゃん
September 14, 2017
Programming
0
210
竝行
Rubyと竝行
concurrent/pararell
さっちゃん
September 14, 2017
Tweet
Share
More Decks by さっちゃん
See All by さっちゃん
みんなのオブザーバビリティプラットフォームを作ってるんだがパフォーマンスがやばい #mackerelio #srenext
ne_sachirou
0
1.2k
作ってよかったgraceful shutdownライブラリ #kyotogo
ne_sachirou
0
1.1k
path 依存型って何?
ne_sachirou
0
480
野生の onbording と onbording 設計 #kyototechtalk
ne_sachirou
0
570
メトリックはいかにして見え續ける樣になったか #devio2022
ne_sachirou
0
69
名實一致
ne_sachirou
0
610
まかれるあなとみあ ―Mackerel のしくみを理解する 30 分― @ Hatena Engineer Seminar #16
ne_sachirou
0
3k
tacit programming : Point-free, Concatenatives & J
ne_sachirou
0
830
Monitoring Containerized Elixir
ne_sachirou
1
910
Other Decks in Programming
See All in Programming
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
Outline View in SwiftUI
1024jp
1
330
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Quine, Polyglot, 良いコード
qnighy
4
640
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
180
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
Jakarta EE meets AI
ivargrimstad
0
630
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Automating Front-end Workflow
addyosmani
1366
200k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Building Applications with DynamoDB
mza
90
6.1k
Happy Clients
brianwarren
98
6.7k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Fireside Chat
paigeccino
34
3k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Transcript
竝⾏ Pararell
.。oO(さっちゃんですよヾ(〃l _ l)ノ゙☆)
https://hex.pm/packages/holiday_jp https://hex.pm/packages/pqueue2 https://hex.pm/packages/stream_gzip https://hex.pm/packages/stream_hash
竝⾏ Pararell
Node.js is concurrent. Crystal is concurrent. Concurrent
Node.js is concurrent. Crystal is concurrent. Also Ruby is concurrent.
Concurrent
Thread thread1 = Thread.new { } thread2 = Thread.new {
} [thread1, thread2].each &:join Concurrent
Concurrent Ruby https://github.com/ruby-concurrency/concurrent-ruby future = Concurrent::Future.execute { } while future.pending?
sleep 0.1 end future.value Concurrent
Concurrent Ruby https://github.com/ruby-concurrency/concurrent-ruby Concurrent::Promise.execute { }.then { } Concurrent
Concurrent Ruby https://github.com/ruby-concurrency/concurrent-ruby class Echo include Concurrent::Async def echo(msg) print
"#{msg}\n” end End horn = Echo.new horn.async.echo 'oneʼ horn.await.echo 'two' Concurrent
EventMachine https://github.com/eventmachine/eventmachine/ EM::run do client = MyApp.new give_tick = proc
do Gtk::main_iteration_do false EM.next_tick give_tick end give_tick.call end Concurrent
nio4r https://github.com/socketry/nio4r selector = NIO::Selector.new loop do selector.select do |monitor|
end end Concurrent
Crystal https://crystal-lang.org/ ch = Channel(Int).new spawn do ch.send 42 end
value = ch.receive Concurrent
Concurrent ? Pararell ?
Concurrent 竝列 Concurrent Task Task Task
Pararell 竝⾏ Pararell Task Task Task
Go is pararell. Pararell
Go https://golang.org/ ch := make(chan string) go f(“some”, ch) <-
ch Pararell
Go is pararell. Pararell
Go is pararell. Ruby is _ Pararell
pararell https://github.com/grosser/parallel Pararell.map([]) { } Pararell.each([]) { } Pararell.any?([]) {
} Pararell.all?([]) { } Pararell
pararell Inside pararell: Pararell
pararell Inside pararell: Process.fork { } Pararell
pararell Inside pararell: Process.fork { } Pararell
Use Elixir Pararell
Use Elixir Pararell Pararell
Use Elixir Pararell Fault tolerant Pararell
Use Elixir Pararell Fault tolerant Soft realtime Pararell