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
Programming Language Crystal
Search
Daisuke Fujita
July 29, 2015
Technology
770
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Programming Language Crystal
#w8lt 第四回 (2015-07-29) の発表資料です
http://w8lt.connpass.com/event/16856/
Daisuke Fujita
July 29, 2015
More Decks by Daisuke Fujita
See All by Daisuke Fujita
SREcon19 Asia/Pacific Recap
dtan4
0
230
Our Practices of Delegating Ownership in Microservices World
dtan4
4
9k
Kubernetes Cluster Upgrade / Mercari Meetup for Microservices Platform
dtan4
3
4.8k
KubeCon EU 2018 Recap: Multi-Tenancy in Kubernetes: Best Practices Today, and Future Directions / Kubernetes Meetup Tokyo 11 #k8sjp
dtan4
1
2k
Wantedly から Chef を一掃した話 / #chibadan
dtan4
24
11k
さようなら Chef こんにちは Dockerfile / Web Tech Tokyo #1
dtan4
6
7.3k
Docker をフル活用したインフラの紹介と成長し続けるためのインフラ戦略 / #abejameetup
dtan4
19
4.1k
Docker Compose PaaS の作り方、そして社内に導入した話 / #yapc8oji
dtan4
1
8.7k
Writing Kubenetes tools in Go
dtan4
1
3.8k
Other Decks in Technology
See All in Technology
貴方はどのエンジニアリングを磨くのか
hatyibei
0
130
脱金融のフューチャー・デザイン / Future Design Beyond Finance
ks91
PRO
0
150
依頼文化をやめる日 EM視点で語るPlatform EngineeringとInclusive SRE / Discussing Platform Engineering and Inclusive SRE from an EM's Perspective
shin1988
4
5.4k
cccccc
moznion
0
1.9k
AI時代のエンジニアキャリアについて今一度考える
sakamoto_582
2
1.5k
はじめてのWDM
miyukichi_ospf
1
140
Road to SRE NEXTの今までとこれから
hiroyaonoe
0
310
Claude Code公式skillで 自分の仕事を少しずつ手放そう!(Claude Code開発ノウハウ大公開スペシャル by クラスメソッド)
kaym
1
310
関数型の考えを TypeScript に持ち込んで、テストしやすい純粋関数を増やす / Pure at the Core, Effects at the Edge: Bringing Functional Thinking into TypeScript
kaminashi
1
110
[2026-07-15] AI Ready なはずだったアーキテクチャと、見えてきた課題・次に目指す状態
wxyzzz
5
3.1k
CIで使うClaude
iwatatomoya
0
250
凡エンジニアがこの先生きのこるためには。〜TypeScript完全に理解したい〜
alchemy1115
2
180
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Abbi's Birthday
coloredviolet
3
8.6k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.9k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
370
How to Think Like a Performance Engineer
csswizardry
28
2.7k
エンジニアに許された特別な時間の終わり
watany
107
250k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
500
Scaling GitHub
holman
464
140k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
350
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Transcript
Programming Language Crystal 2015-07-29 W8LT#4 @dtan4 IUUQTqJDLSQLZ[T
TF[FNJ ͪͦ͝͏͞·Ͱ͢
ಙాݚ.
IUUQTDSZTUBMTI
IUUQTDSZTUBMTI
IUUQDSZTUBMMBOHPSH
Crystal • Ruby ͬΆ͍γϯλοΫε • ੩తܕνΣοΫ • Crystal ͷίʔυͰ C
ॻ͚Δ • ωΠςΟϒίʔυੜ • Crystal -> LLVM IR -> ωΠςΟϒ http://crystal-lang.org/ https://github.com/manastech/crystal
• ίϯύΠϥ͕ Crystal Ͱ࣮͞ΕͯΔ (!) Crystal http://crystal-lang.org/ https://github.com/manastech/crystal
Crystal • Initial commit 2012-09-04 • v0.1.0 2014-06-19
• ݱࡏ v0.7.4 (2015-06-24) http://crystal-lang.org/ https://github.com/manastech/crystal
Crystal • Πϯετʔϧ (Mac OS X): • Try it online:
http://play.crystal-lang.org/ $ brew tap manastech/crystal $ brew update $ brew install crystal-lang
Crystal • Πϯετʔϧ (Mac OS X): • Try it online:
http://play.crystal-lang.org/ $ brew tap manastech/crystal $ brew update $ brew install crystal-lang CSFXOQNͰDSZTUBMೖΕͯΔͱ 1"5)ʹΑͬͯͿ͔ͭΔ Ϳ͔ͭͬͨ DSZTUBM ·͕͍ͪ
Crystal • εΫϦϓτ࣮ߦ • όΠφϦϏϧυ & ࣮ߦ: • ࠷దԽϏϧυ &
࣮ߦ $ crystal [run] hoge.cr $ crystal build hoge.cr $ ./hoge $ crystal build hoge.cr --release $ ./hoge
Ruby ͱͷҧ͍ • ҾʹܕࢦఆͰ͖Δ def hoge(n : Int) • γϯάϧΫΥʔτͩΊ
• Bool Bool ϦςϥϧɺΫϥε͡Όͳ͍ • RubyGems తͳύοέʔδγεςϜແ͍ • (crystal#220) • ࣗલͷґଘཧγεςϜ͕͋Δ $ crystal deps • ඪ४ϥΠϒϥϦʹ͍Ζ͍ΖἧͬͯΔ • ͳͲͳͲ $VSTFT )551 .BSLEPXO 0"VUI 4QFDʜ
ϕϯνϚʔΫ
ؔ #!/usr/bin/env crystal def tarai(x, y, z) return y if
x <= y tarai(tarai(x - 1, y, z), tarai(y - 1, z, x), tarai(z - 1, x, y)) end puts tarai(13, 10, 0) #!/usr/bin/env ruby def tarai(x, y, z) return y if x <= y tarai(tarai(x - 1, y, z), tarai(y - 1, z, x), tarai(z - 1, x, y)) end puts tarai(13, 10, 0)
ؔ #!/usr/bin/env crystal def tarai(x, y, z) return y if
x <= y tarai(tarai(x - 1, y, z), tarai(y - 1, z, x), tarai(z - 1, x, y)) end puts tarai(13, 10, 0) #!/usr/bin/env ruby def tarai(x, y, z) return y if x <= y tarai(tarai(x - 1, y, z), tarai(y - 1, z, x), tarai(z - 1, x, y)) end puts tarai(13, 10, 0) ιʔείʔυ શ͘ಉ͡ ճ UBSBJݺͼग़͠
ؔ 3VCZ $SZTUBM ͦͷ·· $SZTUBM Ϗϧυࡁ $SZTUBM ࠷దԽࡁ UBSBJ
T T T T
ؔ 3VCZ $SZTUBM ͦͷ·· $SZTUBM Ϗϧυࡁ $SZTUBM ࠷దԽࡁ UBSBJ
T T T T ͦͷ··Y όΠφϦϏϧυY
؆୯ͳ HTTP αʔό #!/usr/bin/env crystal require "http/server" server = HTTP::Server.new(8080)
do |request| HTTP::Response.ok "text/plain", "Hello world!" end server.listen #!/usr/bin/env ruby require "rack" app = Proc.new do |env| ["200", { "Content-Type" => "text/plain" }, ["Hello world!"]] end Rack::Handler::WEBrick.run(app, Port: 8080)
؆୯ͳ HTTP αʔό 3VCZ $SZTUBM ͦͷ·· $SZTUBM Ϗϧυࡁ $SZTUBM ࠷దԽࡁ
ฒྻ SFRT SFRT SFRT SFRT SFRT $ ab -k -c 10 -n 10000 http://localhost:8080/
؆୯ͳ HTTP αʔό 3VCZ $SZTUBM ͦͷ·· $SZTUBM Ϗϧυࡁ $SZTUBM ࠷దԽࡁ
ฒྻ SFRT SFRT SFRT SFRT SFRT $ ab -k -c 10 -n 10000 http://localhost:8080/ ͦͷ··Y ࠷దԽϏϧυY
WAF • Codcore/amethyst (ࢵਫথ) • Rails ͬΆ͍ͭ • druvrajvanshi/Moonshine •
Sinatra ͬΆ͍ͭ
ॴײ • ໊͍ • άάϥϏϦςΟ͍ • Go όΠφϦు͚Δ͚Ͳจ๏͕…ͱ͍͏ Rubyist ʹέ͕ྑͦ͞͏
• Ruby ք۾ͷࢿ࢈ΛҠ২ͦ͢͠͏ • ΤίγεςϜڵོͯ͠΄͍͠