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
mercury/mithril.js
Search
Yosuke Furukawa
PRO
April 24, 2015
Programming
11k
14
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
mercury/mithril.js
react meetup #1 資料
Yosuke Furukawa
PRO
April 24, 2015
More Decks by Yosuke Furukawa
See All by Yosuke Furukawa
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
310
デザインシステムが必須の時代に
yosuke_furukawa
PRO
2
250
Node.js, Deno, Bun 最新動向とその所感について
yosuke_furukawa
PRO
10
5.3k
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
1
4.8k
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
360
Removing Corepack
yosuke_furukawa
PRO
9
2k
JavaScript Runtime とはなにか
yosuke_furukawa
PRO
15
3.2k
Strip Types と Storage
yosuke_furukawa
PRO
4
520
Module Harmony について
yosuke_furukawa
PRO
4
1.9k
Other Decks in Programming
See All in Programming
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
550
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
340
これって Effect でできたのでは? / TSKaigi Mashup Kansai #2
susisu
0
150
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
810
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
320
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
120
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
140
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
490
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
130
AI Nativeにデータを扱うための組織・基盤のこれまでとこれから
kirimaru
0
110
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
150
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
180
Featured
See All Featured
Become a Pro
speakerdeck
PRO
31
6.2k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
64
56k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
200
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
370
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
350
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
240
Embracing the Ebb and Flow
colly
88
5.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
850
Speed Design
sergeychernyshev
33
2k
Transcript
mercury / mithril.js @yosuke_furukawa
@yosuke_furukawa Node.jsϢʔβʔάϧʔϓද / DeNAॴଐ
ࠓͷςʔϚ
Performance
Introduction To React (@hokaccha) https://speakerdeck.com/hokaccha/introduction-to-react
Introduction To React (@hokaccha) https://speakerdeck.com/hokaccha/introduction-to-react 3FBDUࣗͦ Μͳʹ͘ͳ͍ #BDLCPOFͰ෦࠶ඳ ը͢Δํ͕͍
ຊͷͱ͜ΖͲ͏ͩΖ͏͔
lhorie TodoMVC Peformance http://lhorie.github.io/todomvc-perf-comparison/todomvc-benchmark/
lhorie TodoMVC Peformance http://lhorie.github.io/todomvc-perf-comparison/todomvc-benchmark/ ͔֬ʹͦ͜·Ͱ ͘ͳ͍
lhorie TodoMVC Peformance http://lhorie.github.io/todomvc-perf-comparison/todomvc-benchmark/ ͔֬ʹͦ͜·Ͱ ͘ͳ͍ .FSDVSZ .JUISJM
ReactΑΓߴͳ mercuryͱmithrilͲ͏͍͏ ߟ͑ํͰߴԽ͍ͯ͠Δͷ͔
ReactͷඳըΞϧΰϦζϜ
ReactͷඳըΞϧΰϦζϜ Before After ֤͝ͱʹ Node ͷมߋ͕ଘࡏ͢Δ͔֬ೝ͢Δ (Level By Level diff)
ReactͷඳըΞϧΰϦζϜ Before After ҰͭҰͭͷNodeʹID͕ৼΒΕ͓ͯΓɺͦͷIDΛݩ ʹॱংͷಉҰੑɺ༰ͷࠩΛݟͯdiffΛΔ ID ID ID ID ID
ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID ID
ReactͷඳըΞϧΰϦζϜ ঢ়ଶมߋ TFU4UBUF ͞ΕΔͱEJSUZqBH͕ ཱͪɺࢠϊʔυ͕࠶ඳըରʹͳΔ
ReactͷඳըΞϧΰϦζϜ /PEFʹରͯ͠ঢ়ଶมߋ TFU4UBUF ͞ΕΔͱEJSUZqBH͕ ཱͪɺࢠϊʔυશ͕ͯ࠶ඳըରʹ ͳΔ
ReactͷඳըΞϧΰϦζϜ ࢠϊʔυͷҰ෦࠶ඳըͤͨ͘͞ͳ ͍߹ TIPVME$PNQPOFOU6QEBUFΛ͑ ࠶ඳը͠ͳ͘ͳΔɻ
mithrilͷΞϓϩʔν
࠶ඳըͷܭࢉճΛݮΒ͢
var doStuff = function() { m.startComputation(); setTimeout(function() { console.log("hello"); m.endComputation();
}, 1000); }; mithrilͷΞϓϩʔν
var doStuff = function() { m.startComputation(); setTimeout(function() { console.log("hello"); m.endComputation();
}, 1000); }; mithrilͷΞϓϩʔν counter: 0
var doStuff = function() { m.startComputation(); setTimeout(function() { console.log("hello"); m.endComputation();
}, 1000); }; mithrilͷΞϓϩʔν counter: 1 TUBSU$PNQVUBUJPOͰ࠶ඳ ըΧϯλΛ܁Γ্͛
var doStuff = function() { m.startComputation(); setTimeout(function() { console.log("hello"); m.endComputation();
}, 1000); }; mithrilͷΞϓϩʔν counter: 0 FOE$PNQVUBUJPOͰ࠶ඳը ΧϯλΛԼ͛Δ
var doStuff = function() { m.startComputation(); setTimeout(function() { console.log("hello"); m.endComputation();
}, 1000); }; mithrilͷΞϓϩʔν counter: 0 ࠶ඳըΧϯλ͕ʹͳͬ ͨΒ࠶ඳըΛ࣮ߦ
var doStuff = function() { m.startComputation(); jQuery.ajax("/something").done(function() { doStuff(); jQuery.ajax("/another").done(function()
{ doMoreStuff(); jQuery.ajax("/more").done(function() { if (callback) callback(); m.endComputation(); }); }); }); }; mithrilͷΞϓϩʔν ඇಉظॲཧ͕ෳճ࣮ߦ͞Εͨ࣌Ͱ͋ͬͯɺ ࠶ඳըΛ࠷ޙ·ͰͨͤΔ͜ͱ͕Ͱ͖Δɻ
setInterval(function(){ m.redraw(true); counter++; }, 100); mithrilͷΞϓϩʔν ஞ࣍తʹ࠶ඳըΛ͍ͨ͠߹ redrawΛ໌ࣔత ʹݺͿ
ͪͳΈʹ mithrilͷৄࡉ @shibu_jp ͕ৄ͘͠ڭ͑ͯ͘Ε·ͨ͠ɻ
mercuryͷΞϓϩʔν
࠶ඳըճΛݮΒ͢ & vdom treeͷ୳ࡧൣғΛݮΒ͢
࠶ඳըճΛݮΒ͢ & vdom treeͷ୳ࡧൣғΛݮΒ͢ vdom-thunk
VDOM ͷ tree ͷ୳ࡧൣғΛݶ ఆ͢Δ QBSUJBMΛ࡞ͬͯͦ͜ҎԼΛݟΔɻ IFBEFSʹ͕ؔ͋ΔͳΒͦ͜ ҎԼ͔͠ݟͳ͍
VDOM ͷ tree ͷ୳ࡧൣғΛݶ ఆ͢Δ var Thunk = require("vdom-thunk") function
render(state) { return h('div', [ Thunk(header, state.head), // headͷঢ়ଶ͕มΘͬͨΒheader͚ͩݟΔ main(), Thunk(footer, state.foot) // footͷঢ়ଶ͕มΘͬͨΒfooter͚ͩݟΔ ]) } function header(head) { ... } function main() { ... } function footer(foot) { ... } શؔ͘ͷͳ͍ྖҬΛ୳ࡧ͢Δ͜ͱΛͳ͘͢ (ͳΜ͔ͪΐͬͱͬͨײ…)
ͭ·Γ
·ͱΊ • React͕ͬͯΔ͜ͱઃܭͱੑೳͷڞଘ • ͞ΒʹੑೳΛ্͛ΔࣄͰ͖Δɻ • ͨͩ͠ɺ1͍ͭϨΠϠʔͰͷॲཧ͕ٻΊΒΕΔɻ • ReactͰ͍ͱײ͡ΔΑ͏ͳϦονͳΣϒΞϓϦ έʔγϣϯΛ࡞Γ͍ͨͳΒmercury/mithrilΛࢼ͢ͷ
ྑ͍͔ɻ
see also • http://calendar.perfplanet.com/2013/diff/ • https://github.com/Raynos/mercury • http://lhorie.github.io/todomvc-perf- comparison/todomvc-benchmark/ •
http://lhorie.github.io/mithril/ • @shibu_jp