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.3k
作ってよかったgraceful shutdownライブラリ #kyotogo
ne_sachirou
0
1.2k
path 依存型って何?
ne_sachirou
0
540
野生の onbording と onbording 設計 #kyototechtalk
ne_sachirou
0
610
メトリックはいかにして見え續ける樣になったか #devio2022
ne_sachirou
0
76
名實一致
ne_sachirou
0
640
まかれるあなとみあ ―Mackerel のしくみを理解する 30 分― @ Hatena Engineer Seminar #16
ne_sachirou
0
3k
tacit programming : Point-free, Concatenatives & J
ne_sachirou
0
910
Monitoring Containerized Elixir
ne_sachirou
1
940
Other Decks in Programming
See All in Programming
Ça bouge du côté des animations CSS !
goetter
2
160
もう僕は OpenAPI を書きたくない
sgash708
6
1.9k
クリーンアーキテクチャから見る依存の向きの大切さ
shimabox
5
1.1k
Honoとフロントエンドの 型安全性について
yodaka
7
1.5k
SwiftUI Viewの責務分離
elmetal
PRO
2
280
複数のAWSアカウントから横断で 利用する Lambda Authorizer の作り方
tc3jp
0
120
Generating OpenAPI schema from serializers throughout the Rails stack - Kyobashi.rb #5
envek
1
400
はじめての Go * WASM * OCR
sgash708
1
110
コードを読んで理解するko build
bells17
1
110
生成AIで加速するテスト実装 - ロリポップ for Gamersの事例と 生成AIエディタの活用
kinosuke01
0
130
楽しく向き合う例外対応
okutsu
0
710
仕様変更に耐えるための"今の"DRY原則を考える
mkmk884
9
3.2k
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Navigating Team Friction
lara
183
15k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
227
22k
Music & Morning Musume
bryan
46
6.4k
Docker and Python
trallard
44
3.3k
Embracing the Ebb and Flow
colly
84
4.6k
Gamification - CAS2011
davidbonilla
80
5.2k
Making Projects Easy
brettharned
116
6k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
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