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
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
160
Jakarta EE meets AI
ivargrimstad
0
600
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
910
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
880
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
Quine, Polyglot, 良いコード
qnighy
4
640
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
110
Featured
See All Featured
Become a Pro
speakerdeck
PRO
25
5k
Building Adaptive Systems
keathley
38
2.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
How GitHub (no longer) Works
holman
310
140k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Unsuck your backbone
ammeep
668
57k
GitHub's CSS Performance
jonrohan
1030
460k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Adopting Sorbet at Scale
ufuk
73
9.1k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
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! ʮϖύϘΩϟϦΞ࠾༻ʯݕࡧ