Worker Previews で CPU とヒープのプロファイリングが可能に
原題: CPU and heap profiling for Worker Previews
changelog / Storage / Workers, Durable Objects / 2026/11/23 09:00 JST
Worker PreviewsでCPUとヒープのプロファイリングが可能になった。プルリクエストごとにPreviewへトラフィックを送り、デプロイ単位でCPU・ヒープのプロファイルを取得してフレームグラフで確認できる。変更がCPU時間やメモリにどれだけ影響するかをマージ前に測れるため、性能劣化の見逃しを防げる。コーディングエージェントがPreviewで負荷をかけてプロファイルを取り、最も重い関数を書き換えて再デプロイする、といった性能改善の反復も安全に行える。本番環境に触れずに検証できる点が利点だ。
出典サイトで原文を開く → 出典サイトの説明: Capture CPU and heap profiles from Worker Previews and Durable Objects on a Preview, and inspect them as flamegraphs.
You can now profile Worker Previews , following the launch of on-demand CPU and memory profiling ↗︎ for Workers and Durable Objects. This lets you see what a pull request costs in CPU and memory before you merge it. Send traffic to a Preview, capture a CPU or heap profile from one of its deployments, and see which functions in your branch use the most CPU time or memory. Push a fix, profile the next deployment, and compare. Production stays untouched the whole time. In this Preview, formatPrice takes almost a third of the CPU time because it creates a new Intl.NumberFormat for every product. A slowdown like this is easy to miss in code review, but it stands out in a flamegraph. Let your agent optimize performance Previews give coding agents a safe place to iterate on performance. An agent can deploy a Preview, send it load, capture a profile, rewrite the hottest function, and deploy again, until CPU time stops dropping. Each Preview deployment has its own ID, so every profile maps to an exact version of the code. Copy prompt Prompt copied! Capture a profile with the Cloudflare CLI : cf previews deployments profile latest \ —worker my-worker \ —preview my-preview \ —duration-ms 5
出典: 公式ページ