Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
blitz_test_speed.pdf
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Tetsuya Fukuda
February 03, 2023
Technology
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
blitz_test_speed.pdf
Tetsuya Fukuda
February 03, 2023
Transcript
22 slides
Blitz.jsのテスト遅い問 題を解決したい!! KYOTO.JS 18
自己紹介 GHKEN Twitter: @gendaihyousyou RIT Inc. CTO/CHRO ◦ Next, Rails,
AWS多め 2歳の娘と0歳の息子
Blitz.js使ってますか? Next.js + Prismaなフルスタックフレームワーク スポンサーやってます
課題
テストが遅い
テストが遅い
単純な例で確認してみる
単純な例で確認してみる
テストが増えるとどうなるか
テストが増えるとどうなるか
どうやらこいつが悪そう
db.$resetは何をしてるのか
db.$resetを使わずにど うするか
Railsだとどうなってる?
SAVEPOINTを使ってる
ただ、現状のPrismaではサポートされてなさそう
truncateしてみる
おもったより早くない
なぜか
deleteにしてみる
早くなった
結論 ⚫db.$resetを使わない ⚫データが少ないならtruncateではなくdeleteのほうが早い ⚫(今回は問題に遭遇しなかったけど)deleteだけだとauto incrementずれるので注意 ⚫RailsだとSAVEPOINT使ってネストしたトランザクションからロールバックしてるので早い
More Decks by Tetsuya Fukuda
See All by Tetsuya Fukuda
アプリケーションの拡大に伴う開発者体験の悪化をなんとかする
ghken
0
86
辛くない受託開発
ghken
0
3.1k
Other Decks in Technology
See All in Technology
[NW-JAWS DAY]「うちのAWS、インターネット出られないんで」― AWS外の自社サービスをPrivateLinkでシュッと公開する方法
ykimi
3
930
Well, that’s weird…
csswizardry
1
210
IP重複は"ランディングVPC"で受け止める ― PrivateLink と Transit Gatewayによるマルチテナント接続基盤の設計
hatahata021
3
270
社内アプリ基盤「Quartz」による、 非エンジニアとAIに本番デプロイを 任せても壊れないプラットフォームの設計
staka121
PRO
1
230
メディアアートを〈拡張〉する——器官学と個体化論を手がかりに
_kotobuki_
0
270
業務の傍らで進める改善ループエンジニアリング
bengo4com
1
240
Taking back control of your AI development
inesmontani
PRO
0
310
さようならSSH鍵、こんにちはゼロトラスト ― AIフレンドリーで快適な自宅鯖SSH
atalie2m
14
7.6k
20261119_AgentCore
takuyay0ne
2
300
その修正で本当に速くなったのか? k6とOpenTelemetryで確かめる性能改善 / Performance review with k6 and OpenTelemetry
ymotongpoo
3
440
Is the Website Dying?
miriamschwab
0
180
Go でトランザクション、どう書いてますか?
knwoop
2
620
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
30 Presentation Tips
portentint
PRO
1
480
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
620
Paper Plane (Part 1)
katiecoart
PRO
3
12k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.3k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
670
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k