$30 off During Our Annual Pro Sale. View Details »
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
メール送信サーバの集約における透過型SMTP プロキシの定量評価 / Quantitative Evaluation of Transparent SMTP Proxy in Email Sending Server Aggregation
linyows
0
79
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
250
研究の再現性を高める 仕組みをGoでつくる / Creating a system to improve the reproducibility of research using go
linyows
1
130
奥が深いメールのシステム / The depth of Email system
linyows
4
440
IaCにおけるテスト考察 / Tests in IaC
linyows
2
460
リバースエンジニアリングとGoでSlackの認知負荷を下げる / Reducing cognitive load in Slack with Reverse-engineering and Go
linyows
2
290
透過型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
530
求められるソフトウェアエンジニア像とキャリア戦略 / Engineers and Career Strategies Required Now
linyows
2
490
Other Decks in Programming
See All in Programming
CSC305 Lecture 25
javiergs
PRO
0
120
romajip: 日本の住所CSVデータを活用した英語住所変換ライブラリを作った話
sangunkang
0
2.4k
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
120
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
130
React + Tauriでデスクトップアプリ開発に入門してみた
ynishimura0922
0
220
Thoughts and experiences on Rust and TypeScript
unvalley
2
220
Refactor your code - refactor yourself
xosofox
1
180
PipeCDの歩き方
kuro_kurorrr
4
140
nekko cloudにおけるProxmox VE利用事例
irumaru
2
130
かんたんデザイン編集やってみた~「完全に理解した」までの道のり~
morit4ryo
1
120
Cognitoが大型アップデート!Managed Loginとパスワードレスログインを実際に使ってみた@しむそくRadio Special Day1
tmhirai
3
270
flutterkaigi_2024.pdf
kyoheig3
0
470
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
How to Ace a Technical Interview
jacobian
276
23k
Code Reviewing Like a Champion
maltzj
520
39k
Facilitating Awesome Meetings
lara
50
6.1k
We Have a Design System, Now What?
morganepeng
51
7.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.2k
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! ʮϖύϘΩϟϦΞ࠾༻ʯݕࡧ