Open4
Ruby on Railsのベンチマーク、プロファイリング
![pocke](https://res.cloudinary.com/zenn/image/fetch/s--FHB3bqJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/7427bc8520.jpeg)
Rails.cache
について。
rails runnerなどでテストするなら、Rails.cache.with_local_cache
でコードを囲んだほうが良い。
開発環境でテストするなら、expires_inを確認したほうが良い。
![pocke](https://res.cloudinary.com/zenn/image/fetch/s--FHB3bqJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/7427bc8520.jpeg)
ActiveRecordのキャッシュ
rails runnerなどでテストするなら、ApplicationRecord.cache
でコードを囲んだほうが良い。ApplicationRecord
相当のものが複数あればいい感じにするべきだと思う。
![pocke](https://res.cloudinary.com/zenn/image/fetch/s--FHB3bqJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/7427bc8520.jpeg)
ログレベル
ログレベルは意外とパフォーマンスに影響する。開発環境でテストするなら、本番環境と同じログレベルに合わせたほうが良い。
![pocke](https://res.cloudinary.com/zenn/image/fetch/s--FHB3bqJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/7427bc8520.jpeg)
https://github.com/rails/rails/pull/42903/files with_local_cache, 消えてた