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
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
710
return文におけるstd::moveについて
onihusube
1
980
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
これでLambdaが不要に?!Step FunctionsのJSONata対応について
iwatatomoya
2
3.6k
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
From Translations to Multi Dimension Entities
alexanderschranz
2
130
선언형 UI에서의 상태관리
l2hyunwoo
0
150
testcontainers のススメ
sgash708
1
120
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
137
6.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
RailsConf 2023
tenderlove
29
940
Code Reviewing Like a Champion
maltzj
520
39k
Six Lessons from altMBA
skipperchong
27
3.5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
It's Worth the Effort
3n
183
28k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
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! ʮϖύϘΩϟϦΞ࠾༻ʯݕࡧ