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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
デザインシステムが必須の時代に
yosuke_furukawa
PRO
2
230
Node.js, Deno, Bun 最新動向とその所感について
yosuke_furukawa
PRO
10
5.2k
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
1
4.7k
tc39 x jsconf.jp Panel Discussion 2024
yosuke_furukawa
PRO
0
340
Removing Corepack
yosuke_furukawa
PRO
9
2k
JavaScript Runtime とはなにか
yosuke_furukawa
PRO
15
3.1k
Strip Types と Storage
yosuke_furukawa
PRO
4
510
Module Harmony について
yosuke_furukawa
PRO
4
1.9k
LTのやり方
yosuke_furukawa
PRO
16
3k
Other Decks in Programming
See All in Programming
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
710
ふつうのFeature Flag実践入門
irof
8
4k
The NotImplementedError Problem in Ruby
koic
1
840
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
160
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
710
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
210
dRuby over BLE
makicamel
2
380
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
140
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
180
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
270
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
Performance Engineering for Everyone
elenatanasoiu
0
180
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Automating Front-end Workflow
addyosmani
1370
210k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Google's AI Overviews - The New Search
badams
0
1k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
Building Adaptive Systems
keathley
44
3.1k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
270
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
270
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
150
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