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
Denoの仕組み / How deno works as TypeScript runtime
Search
linyows
August 23, 2021
Programming
2
790
Denoの仕組み / How deno works as TypeScript runtime
Fukuoka.ts#3 Aug 23, 2021 での発表です。
linyows
August 23, 2021
Tweet
Share
More Decks by linyows
See All by linyows
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
210
研究の再現性を高める 仕組みをGoでつくる / Creating a system to improve the reproducibility of research using go
linyows
1
120
奥が深いメールのシステム / The depth of Email system
linyows
3
420
IaCにおけるテスト考察 / Tests in IaC
linyows
2
440
リバースエンジニアリングとGoでSlackの認知負荷を下げる / Reducing cognitive load in Slack with Reverse-engineering and Go
linyows
2
280
透過型SMTPプロキシによる送信メールの可観測性向上 / Improved observability of outgoing emails with transparent smtp proxy
linyows
2
960
プロダクションで使うGo Pluginの利便性とパフォーマンス性 / Simplicity and Performance of Go plugin for Production
linyows
0
510
求められるソフトウェアエンジニア像とキャリア戦略 / Engineers and Career Strategies Required Now
linyows
2
480
CloudflareのCAPTCHAを使って ユーザ体験を下げず不正利用を排除する / Cloudflare's captcha case study that does not degrade ux
linyows
0
360
Other Decks in Programming
See All in Programming
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
Jakarta EE meets AI
ivargrimstad
0
150
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
Jakarta EE meets AI
ivargrimstad
0
610
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
受け取る人から提供する人になるということ
little_rubyist
0
230
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
Outline View in SwiftUI
1024jp
1
330
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
100
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Become a Pro
speakerdeck
PRO
25
5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
For a Future-Friendly Web
brad_frost
175
9.4k
Facilitating Awesome Meetings
lara
50
6.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
4 Signs Your Business is Dying
shpigford
180
21k
Agile that works and the tools we love
rasmusluckow
327
21k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Transcript
Fukuoka.ts #3 TS How deno works as TS runtime Tomohisa
Oda — GMO Pepabo, Inc. / Aug 23th 2021
Fukuoka.ts #3 linyows / Tomohisa Oda GMO Pepabo, Inc.: Senior
Engineering Lead Blog: https://tomohisaoda.com 2
Fukuoka.ts #3 3 Private Projects ΞϓϦέʔγϣϯ͕ࣗϦϙδτϦ͔ Β࠷৽ͷίʔυΛݕͯࣗ͠ಈͰσϓϩ ΠͱσϦόϦʔΛߦ͏πʔϧ linuxͷuser໊લղܾΛGitHubͷ TeamϝϯόʔϦϙδτϦͷΞΫηε
ݖݶऀ͔Βߦ͏πʔϧ ϝʔϧૹ৴༻ͷಁաܕSMTPϓϩΩγͰ ϦΫΤετͱϨεϙϯεΛϩάσʔλ ϕʔεʹग़ྗ͢Δ͜ͱ͕Ͱ͖Δ New!!
Fukuoka.ts #3 ͓ͼɿDenoਂງΓ👉DenoͷΈ 4
Fukuoka.ts #3 Denoͱʁ Denoɺ@ry͕nodejsͰޙչ͍ͯ͠Δ͜ͱʢgypnode_modulespromiseͳͲʣ͔ΒϓϩδΣΫ τΛ։࢝ɻV8Λϥοϓͨ͠RustͷTypeScript/JavaScript ϥϯλΠϜɻϥϯλΠϜ୯ମͱ͍͏ΑΓ ͦΕΛؚΊͨπʔϧνΣʔϯɻ ҎԼɺΦϑΟγϟϧ͔Βɻhttps://deno.land/ • σϑΥϧτͰηΩϡΞ
👉 deno run —allow-net —allow-read foo.ts • TypeScriptΛͦͷ··αϙʔτ 👉 tscswc͕෦ͰΘΕ͍ͯΔ • γϯάϧϑΝΠϧͷΈͰಈ͘ 👉 deno compile foo.ts => file • ґଘؔݕࠪϑΥʔϚοτ༻ͷπʔϧͳͲಉࠝ 👉 deno info, deno fmt, deno test… • ಈ࡞อূͷඪ४Ϟδϡʔϧ 5
Fukuoka.ts #3 Denoͷߏ ෳͷίϯϙʔωϯτʹׂ͞Ε͍ͯͯɺ3rd Party͕ଟ༻͞Ε͍ͯΔɻ3rd Party͕ॏཁͳϙδγϣϯʹΔͨΊɺͦΕΒΛִ͢ΔϨΠϠʔߏʹͳͬ ͍ͯΔɻ deno_core(rusty_v8(v8(js & wasm)))
Έ͍ͨͳײ͡ɻ • RustͷඇಉظϥϯλΠϜTokioΛ͍ͬͯΔ • RustͱV8ͷBindingsʹrusty_v8͕୲͍ͬͯͯͦΕ3rd Party • TSඪ४Ϟδϡʔϧ 6
Fukuoka.ts #3 7 https://choubey.gitbook.io/internals-of-deno/architecture/overall-architecture
Fukuoka.ts #3 V8ͱRustͷׂ୲ deno༷ʑͳίϯϙʔωϯτ͕͋ΓଞݴޠͰߏ͞Ε͍ͯΔɻઈࡶʹ͍͏ͱɺdenoV8ͷϥούʔ Ͱ͋Δ͕ɺRustԿΛ͍ͯ͠Δͷ͔ɻ • V8͕Ͱ͖ΔͷSandboxͰECMAScriptͷղऍͰɺͦΕҎ֎ͷωοτϫʔΫϑΝΠϧૢ࡞ͳͲ RustଆͰߦ͏ • ωοτϫʔΫϑΝΠϧૢ࡞ηΩϡϦςΟͷ੍ݶΛड͚ɺ࣮ߦ࣌ʹڐՄ͓ͯ͘͠ඞཁ͕͋Δ
• V8ͱRust͋Β͔͡Ίఆٛͨؔ͠Ͱ૬ޓʹΓͱΓ͢Δ͜ͱ͕Ͱ͖Δ • σʔλϙΠϯλʔΛ͍ίϐʔ͠ͳ͍ʢจࣈྻͰͳ͍ͷͰύϑΥʔϚϯεͷ͕͓͖ͳ ͍ʣ • ॳظRustͰͳ͘GoͰ࣮͞Ε͍͕ͯͨGoͱV8ͷ̎ॏGCͷ͔ΒRustʹஔ͖͑ΒΕͨ 8
Fukuoka.ts #3 9 ΠϯλʔϑΣʔεOpsͱResourceͷ̎छྨ https://www.youtube.com/watch?v=1b7FoBwxc7E
Fukuoka.ts #3 Denoͷϓϩηε DenoRustϓϩηεͱͯ͠ىಈͯ͠ɺdenoͷϝΠϯεϨουͱV8ͷWorkerεϨουͱ TokioͷεϨουϓʔϧʹΑΓߏ͞ΕΔɻ • tsc·ͨswcʹΑͬͯґଘղܾͱϦϞʔτϑΝΠϧͷμϯϩʔυΛߦ͍γϯάϧϑΝ ΠϧԽ • ͦͷjswasm͕V8ͷதͰ࣮ߦ͞ΕΔ
• V8ʹͳ͍ؔRustଆΛݺͼग़͢ • Event Loopͷcore෦RustଆͰ࣮͞ΕTokioεέδϡʔϥʔͱͯ͠εϨουΛ ཧ͢Δ 10
Fukuoka.ts #3 11 https://deno.land/
[email protected]
/contributing/architecture Manualʹ͋ͬͨArchitectureਤʢࠓlibdeno͕rusty_v8ʹͳ͍ͬͯΔ͔Βݹ͍͔ʣ
Fukuoka.ts #3 Denoͷ֦ு V8WebAssembly(wasm) ࣮ߦͰ͖ΔͨΊɺwasmରԠ ͷͲΜͳݴޠͰ֦ு͕ՄೳͰ ͋Δɻ·ͨɺ࠷ۙಋೖ͞Εͨ dlopen ͰμΠφϛοΫϩʔυ ʹΑΔ֦ு͕Ͱ͖ΔΑ͏ʹͳͬ
͍ͯΔ(v1.13)ɻ 12
Fukuoka.ts #3 Demo: rust(wasm-pack)Ͱdeno֦ு 13
Fukuoka.ts #3 14 ςϯϓϨʔτͰwasmͷgreetؔͰjsͷalertؔʹbind͢ΔΑ͏ʹ
Fukuoka.ts #3 ·ͱΊ • Denonode.jsͰͷܦݧ͔ΒV8ͱͷ݁߹ʹநϨΠϠʔΛ࡞Δ͜ͱͰ҆શʹ͍ͯ͠Δ • V8Ҏ֎ʹtokiotscɺswcͳͲ3rd Party͕ଟ͘ΘΕҰൠతͳݴޠϥϯλΠϜͰෳࡶ Ͱ͋Δ͕ίϯϙʔωϯτΛࡉׂ͔͘͢Δ͜ͱͰӨڹΛখ͍ͯ͘͞͠Δ •
ϑΝΠϧૢ࡞ωοτϫʔΫͳͲV8ͷείʔϓ֎rust͕୲͍ͬͯͯϗϫΠτϦετͷη ΩϡϦςΟͰ҆શΛ୲อ͍ͯ͠Δ • V8ͱRustͷؒʹσʔλίϐʔͳͦ͘ͷଞͷύϑΥʔϚϯεʹྗͰ͖ΔΑ͏ʹ͍ͯ͠Δ 15
Fukuoka.ts #3 16 Thank You, We’re Hiring! ʮϖύϘΩϟϦΞ࠾༻ʯݕࡧ