# 推測するな、計測せよ ## 概要 エンジニア界隈で用いられる格言のひとつ。 パフォーマンス最適化において、推測に基づく最適化を諌め、計測に基づく最適化を推奨する。 ## 元ネタ [[ロブ・パイク]]氏が執筆した[Notes on Programming in C](http://www.literateprogramming.com/pikestyle.pdf)中の以下の記述が元ネタとされる。 >[!quote]+ [Notes on Programming in C](http://www.literateprogramming.com/pikestyle.pdf)より > Rule 1. You can’t tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don’t try to second guess and put in a speed hack until you’ve proven that’s where the bottleneck is. > Rule 2. Measure. Don’t tune for speed until you’ve measured, and even then don’t unless one part of the code overwhelms the rest. ## 関連リンク - [Notes on Programming in C](http://www.literateprogramming.com/pikestyle.pdf) - [UNIX哲学 - Wikipedia](https://ja.wikipedia.org/wiki/UNIX%E5%93%B2%E5%AD%A6#%E3%83%91%E3%82%A4%E3%82%AF:_C%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E3%81%AB%E9%96%A2%E3%81%99%E3%82%8B%E8%A6%9A%E3%81%88%E6%9B%B8%E3%81%8D) - [「推測するな、計測せよ」ソウゾウで始動したエンジニア組織の生産性可視化 | mercan (メルカン)](https://careers.mercari.com/mercan/articles/34283/) - [「推測するな、計測せよ」という訳はミスリードと言う話 - aki33524’s blog](https://aki33524.hatenablog.com/entry/2023/08/25/231051)