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
throttleすげぇぇぇ
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Sigma
October 10, 2022
Programming
87
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
throttleすげぇぇぇ
Sigma
October 10, 2022
More Decks by Sigma
See All by Sigma
Proxmox_VE.pdf
seiyasugimoto
0
230
Stable Diffusionで遊んでみた
seiyasugimoto
1
150
EVAフレームワーク
seiyasugimoto
0
120
SSR+SPA
seiyasugimoto
0
170
Nuxtにおける設計
seiyasugimoto
0
110
Atomic Designを ディレクトリ以外で表現
seiyasugimoto
0
94
スマホでPythonしたい
seiyasugimoto
0
76
平文で保存するな!
seiyasugimoto
0
99
ソースコードを読もう
seiyasugimoto
0
100
Other Decks in Programming
See All in Programming
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
700
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
240
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
5
540
承認済みなのに差戻しできてしまうバグ、型で潰せます
shinchit
0
110
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
170
Cloudflare is Agents
chimame
0
180
FastAPI の並行処理モデルを完全に理解する
hoto17296
8
3.1k
My Marp Sample
sinoue0108
0
120
バグを直したら useEffect が消えた
colorful12
3
710
「人を評価する AI」の設計と実装
ryoyanara
0
250
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
120
引き算の組織 ― アウトカムとAIに全振りするために辞めたこと ― / Organization by Subtraction
hirokiyamamoto14
PRO
0
300
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
790
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
290
The Mindset for Success: Future Career Progression
greggifford
PRO
0
480
Amusing Abliteration
ianozsvald
1
260
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Designing Experiences People Love
moore
143
24k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
How to build a perfect <img>
jonoalderson
1
5.9k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Scaling GitHub
holman
464
140k
Docker and Python
trallard
47
4.1k
Transcript
throttleがすごい話 Vueのリアクティブシステム
NLP のしぐまです! • 株式会社エヌエルプラスに去年入社しました。 ◦ リファラル採用やってます! • 自分はイベント配信プラットフォーム (受託) 等やってます。
• 現在は主にNuxtとGoとGCPを触っています。 ◦ フルスタックです!何でも屋とも言う…なぜかGoも触ってる… • シニアエンジニアです。
Vueのリアクティブシステム
変数の書き換えが速さがいやらしい場合 • 変数の書き換えに反応して重たい描画機能が走っている場合。書き換えの速さに よって死ぬ。 ◦ 経験したケースでは秒間数十回走るとつらい。 ◦ 高速なチャットとか。 • throttle
で書き換え回数を制限してしまえば安定するのではないか?
throttleの概要 • 関数の実行回数をNミリ秒に一回に制限できる。 ◦ 500 ミリ秒なら秒間 2 回 • Nミリ秒内の実行は無視されず、次の実行可能タイミングに実行される。
• lodashに入ってる
どう制限するか • ウォッチャに throttle で ラップした update 関数 を仕込み、更新回数の 制限された変数を実際
にその変数を描画する コンポーネントに渡す。 DRAW COMPONENT throttled variable: drawするコンポーネントへ渡 す。 update function: throttled variableを更新 watch: callback に throttle update function, 高速 で更新される store の変数を watch STORE
こんな感じ
lodash の throttle が優秀 • 公式ドキュメントから参照され ていた記事 https://css-tricks.com/debou ncing-throttling-explained-e xamples/
にあるデモを一部 throttle 用に書き換えた。
ユースケース(throttle, debounce) • 複数回の誤クリックの対策 • スクロールイベント等の制限 • リアクティブシステムの暴走を止める
イベント駆動な JavaScript を制する