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
800
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
非コンテナ環境において宣言的Deploymentを手軽に実現する / Declarative deployment in non-container environments
linyows
0
21
メール送信サーバの集約における透過型SMTP プロキシの定量評価 / Quantitative Evaluation of Transparent SMTP Proxy in Email Sending Server Aggregation
linyows
0
400
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
260
研究の再現性を高める 仕組みをGoでつくる / Creating a system to improve the reproducibility of research using go
linyows
1
140
奥が深いメールのシステム / The depth of Email system
linyows
4
450
IaCにおけるテスト考察 / Tests in IaC
linyows
2
480
リバースエンジニアリングとGoでSlackの認知負荷を下げる / Reducing cognitive load in Slack with Reverse-engineering and Go
linyows
2
300
透過型SMTPプロキシによる送信メールの可観測性向上 / Improved observability of outgoing emails with transparent smtp proxy
linyows
2
1k
プロダクションで使うGo Pluginの利便性とパフォーマンス性 / Simplicity and Performance of Go plugin for Production
linyows
0
540
Other Decks in Programming
See All in Programming
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
nekko cloudにおけるProxmox VE利用事例
irumaru
3
420
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
200
Zoneless Testing
rainerhahnekamp
0
120
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
930
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
690
From Translations to Multi Dimension Entities
alexanderschranz
2
130
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1k
testcontainers のススメ
sgash708
1
120
Recoilを剥がしている話
kirik
5
6.6k
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Scaling GitHub
holman
458
140k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Documentation Writing (for coders)
carmenintech
66
4.5k
Code Review Best Practice
trishagee
65
17k
Speed Design
sergeychernyshev
25
670
It's Worth the Effort
3n
183
28k
Adopting Sorbet at Scale
ufuk
73
9.1k
Site-Speed That Sticks
csswizardry
2
190
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Writing Fast Ruby
sferik
628
61k
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! ʮϖύϘΩϟϦΞ࠾༻ʯݕࡧ