---
title: "Workers, Durable Objects - CPU and heap profiling for Worker Previews — Cloud Changelog"
description: "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…"
url: "https://cloudchangelog.com/cloudflare/2026-11-23-previews-profiling"
updated: "2026-11-23"
---

[Back to feed](https://cloudchangelog.com/feed/2026-W48)

November 23, 2026 · Cloudflare

# Workers, Durable Objects - CPU and heap profiling for Worker Previews

- [Workers](https://cloudchangelog.com/products/cloudflare/workers)
- [Durable Objects](https://cloudchangelog.com/products/cloudflare/durable-objects)
- [Serverless](https://cloudchangelog.com/search?q=serverless)
- [Compute and containers](https://cloudchangelog.com/search?q=compute)

You can now profile [Worker Previews](https://developers.cloudflare.com/workers/previews/), following the launch of [on-demand CPU and memory profiling ↗︎](https://blog.cloudflare.com/workers-on-demand-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 promptPrompt copied!

Capture a profile with the [Cloudflare CLI](https://developers.cloudflare.com/cf/):

```
cf previews deployments profile latest \
  --worker my-worker \
  --preview my-preview \
  --duration-ms 5000 \
  --profile-type cpu > preview-cpu.pprof
```

Or with the API. Use `latest` to target the newest deployment of the Preview:

```
curl --request POST \
  "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/workers/workers/$WORKER_ID/previews/$PREVIEW_ID/deployments/latest/profile" \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{"duration_ms": 5000, "profile_type": "cpu"}' \
  --output preview-cpu.pprof.gz
```

#### Profile in the dashboard

Open your Preview, select **Observability**, and switch the view to *Flamegraph*. Choose a profile type and a Preview deployment, then select **Capture profile**. Explore the result as a flamegraph or table, or download the raw pprof file.

#### Profile Durable Objects on a Preview

Every Preview gets its own [Durable Object namespaces](https://developers.cloudflare.com/workers/previews/resources/#durable-objects). To see what one object is doing on your branch, profile it by ID, just like in production.

To get started, refer to [Profile a Preview](https://developers.cloudflare.com/workers/previews/test-and-debug/#profile-a-preview).

Get the week’s Cloudflare changes in one email

Your email address

Free, every Monday: only what changed in Cloudflare that week. We email you a link to confirm.

[See last week’s digest](https://cloudchangelog.com/digests/weekly-2026-W47#provider-cloudflare)

Free. Unsubscribe any time.

[Read on developers.cloudflare.com](https://developers.cloudflare.com/changelog/post/2026-11-23-previews-profiling/)

## Related updates

- Oct 9, 2026

  [Workers and Durable Objects support on-demand CPU and memory profiling](https://cloudchangelog.com/cloudflare/cloudflare-blog-2026-10-09-12cb3b705543)
- Sep 22, 2026

  [Workers - Test every pull request in an isolated environment with Worker Previews](https://cloudchangelog.com/cloudflare/2026-09-22-worker-previews)
- Jun 30, 2026

  [Workers, Durable Objects - Track memory usage for Workers and Durable Objects in the dashboard](https://cloudchangelog.com/cloudflare/2026-06-30-memory-usage-metrics)
- Feb 3, 2025

  [Workers - Revamped Workers Metrics](https://cloudchangelog.com/cloudflare/2025-02-03-workers-metrics-revamp)
- Feb 6, 2026

  [Workers - Visualize data, share links, and create exports with the new Workers Observability dashboard](https://cloudchangelog.com/cloudflare/2026-02-06-observability-ui-refresh)

[All Workers changes](https://cloudchangelog.com/products/cloudflare/workers)

## Contact

- [YouTube](https://www.youtube.com/@cloudchangelog)
