Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 205 additions & 0 deletions guides/20260531_from_code_to_compute_in_200ms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
---
title: 'From Code to Compute in 200ms'
description: 'Why low-latency developer loops matter for AI teams, and how Daytona helps you measure and shrink the time from code change to runnable compute.'
date: 2026-05-31
author: 'Johnnie Oduro Jnr'
tags: ['daytona', 'ai-development', 'latency', 'devcontainers', 'performance']
---

# From Code to Compute in 200ms

## Introduction

In AI development, the expensive part is often not the model itself — it is the time between an idea and a trustworthy result.

Every extra minute spent waiting on environment setup, dependency installs, or a slow restart interrupts the feedback loop. When an engineer or agent changes code and then has to wait for a fresh environment to boot, the work stops feeling interactive and starts feeling batch-oriented.

That is why speed matters. A fast path from code to compute keeps humans in flow, keeps agents productive, and reduces the cost of experimentation.

In a world where teams are using [Daytona workspace](</definitions/20240819_definition_daytona workspace.md>) environments to run AI workloads, the goal is not just reproducibility — it is reproducibility that is fast enough to use repeatedly without friction.

This guide shows how to think about the 200ms target, how to measure the handoff from code to runnable compute, and how to design a Daytona-based workflow that gets as close as possible to instant feedback without sacrificing consistency.

## TL;DR

- **Speed is a product feature**: faster loops mean more experiments, quicker debugging, and less context switching.
- **200ms is a mindset**: the goal is a near-instant handoff to ready compute, not a fresh container build every time.
- **Daytona helps by making environments reproducible and shareable**: use [development containers](</definitions/20240819_definition_development container.md>), caching, and prebuilt workspaces to cut startup time.
- **Measure before you optimize**: track create time, attach time, and time-to-first-command.
- **Trade-offs are real**: the fastest setups usually require more discipline around images, dependencies, and platform choices.

## Why 200ms Matters for AI Development

Two hundred milliseconds is roughly the threshold where software begins to feel immediate to a user.

In AI development, that “user” may be a developer, a reviewer, or an agent that needs to validate a patch before moving on to the next step. If the loop is fast, the next action feels natural. If it is slow, the developer starts batching changes, and the agent starts losing momentum.

There are three places where latency hurts most:

1. **Human iteration** — a developer wants to change a prompt, rerun a notebook, and see the effect before the idea gets cold.
2. **Agentic workflows** — an AI agent may need to edit code, execute it, inspect logs, and choose the next step several times in a row.
3. **Team onboarding** — new engineers should contribute quickly; if the environment takes half a day to settle, velocity drops before the first pull request.

That is why the real goal is not “faster for its own sake.” The goal is to shrink the time between edit and evidence. If your environment is reproducible but slow, it still gets in the way. Speed and correctness need to travel together.

## Step 1: Build for Fast Starts, Not Just Clean Starts

A Daytona workflow begins with a [daytona workspace](</definitions/20240819_definition_daytona workspace.md>) backed by a [development container](</definitions/20240819_definition_development container.md>). To keep startup time low, make the container image small and the post-create work minimal.

Here is a lean `devcontainer.json` example:

```json
{
"name": "ai-fast-loop",
"image": "mcr.microsoft.com/devcontainers/python:3.12-bookworm",
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/python:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter"
]
}
},
"forwardPorts": [8000],
"postCreateCommand": "pip install -r requirements.txt"
}
```

A few practical rules keep this fast:

- Use a base image that already contains most of what you need.
- Keep `postCreateCommand` short; move expensive installs into a cached layer.
- Forward only the ports you actually need.
- Avoid heavy extension bundles unless they are part of the workflow.
- Pin dependencies so the cache stays valid across rebuilds.

In other words, the environment should be opinionated, but not bloated.

## Step 2: Start Daytona and Measure the Handoff

The best way to improve latency is to measure it. Daytona makes it easy to create a reproducible workspace; your job is to instrument the path from “code changed” to “compute ready.”

Start the server and create the workspace:

```bash
# Start the Daytona server
daytona server

# In another terminal, create the workspace from the current repo
daytona create . --name ai-fast-loop
```

Now measure the startup path with a simple shell benchmark:

```bash
python3 - <<'PY'
import subprocess
import time

workspace_name = "ai-fast-loop"
start = time.perf_counter()
subprocess.run(["daytona", "create", ".", "--name", workspace_name], check=True)
elapsed_ms = (time.perf_counter() - start) * 1000
print(f"Workspace '{workspace_name}' was ready in {elapsed_ms:.1f} ms")
PY
```

This script gives you a baseline for cold-start behavior. If the number is too high, do not try to “fix” it with wishful thinking. Reduce the amount of work the environment performs during creation.

A useful rule of thumb:

- **Cold start**: everything is built, installed, and initialized from scratch.
- **Warm start**: the workspace already exists and only needs to be attached or resumed.
- **Ready state**: the environment is waiting for the first meaningful command, not still assembling itself.

The 200ms target usually belongs to the warm or ready state, not the first-ever build. That distinction matters.

## Step 3: Tune Daytona for a Faster Loop

Once you have a baseline, focus on the highest-impact changes first.

### 1. Cache the expensive parts

Package installs, model weights, wheel builds, and language toolchains are the usual culprits. Cache them in layers or volumes so every new run does not repeat the same work.

### 2. Keep the workspace close to the code

A Daytona environment is most useful when the code and runtime are already aligned. That means no ad hoc setup scripts, no manual dependency hunts, and no one-off edits on the host machine. The more declarative the environment, the faster it can be recreated.

### 3. Use prebuilds for repeatable branches

If your team frequently opens feature branches or pull requests, prebuild the workspace before someone asks for it. This is where Daytona shines: a ready-to-use environment is much faster than a fresh environment assembled under pressure.

### 4. Avoid “just in case” tools

Every extra CLI, language runtime, or service adds time to setup, validation, and troubleshooting. If a tool is not part of the critical path, leave it out until you need it.

## Step 4: Compare the Trade-offs

No solution wins on every axis. The right choice depends on whether your team values control, simplicity, portability, or raw speed.

| Approach | Strengths | Trade-offs |
| --- | --- | --- |
| Manual local setup | Familiar and flexible | Slow onboarding, drift, and machine-to-machine inconsistency |
| GitHub Codespaces | Easy cloud provisioning and strong editor integration | Tied to GitHub workflows and less flexible for self-hosted control |
| Persistent VM tools such as ForeverVM-style setups | Very fast warm resumes and stable state | More ops burden and the risk of environment snowflakes |
| Daytona workspaces | Reproducible, portable, and fast when tuned with caches and prebuilds | Requires disciplined container design and a little platform knowledge |

The fastest environments are usually the ones that do the least work at startup. Daytona helps because it gives you a structured way to remove unnecessary work instead of hiding it behind a custom machine image.

## Real-World Scenarios Where Speed Pays Off

### AI pair programming and agent loops

An AI agent that edits code, runs tests, reads logs, and patches the same file multiple times benefits from short feedback cycles.

The longer the environment takes to respond, the less effective the agent becomes. A fast Daytona workspace keeps the loop tight enough that the agent can test an idea before the next reasoning step becomes stale.

### Prompt iteration for model applications

Prompt changes are small, but their effects can be surprisingly large. If the environment is ready in near real time, a developer can compare several prompt variants in one sitting instead of spreading them across the afternoon.

### Onboarding new engineers

A new teammate should be able to start from the repository and arrive at a working AI environment quickly. That is a direct productivity gain, but it is also a morale win. Fast onboarding makes the codebase feel alive instead of fragile.

### Team demos and incident response

When a customer issue or internal incident requires immediate reproduction, every minute matters. A ready Daytona workspace makes it easier to inspect the problem, rerun the workload, and ship a fix before the context disappears.

## What to Measure Next

If you want to keep improving, measure three separate numbers:

- **Create time**: how long it takes to build the workspace.
- **Attach time**: how long it takes to connect after the workspace already exists.
- **Time to first useful command**: how long until the environment can run the exact command you care about.

The last metric is usually the most honest. A workspace is not truly fast if it opens quickly but still needs several manual steps before the real work can begin.

## Conclusion

Speed matters in AI development because feedback is the real currency of iteration.

A reproducible environment is good, but a reproducible environment that is also fast is far better. Daytona gives teams the structure to build that kind of workflow.

Consistent [workspaces](</definitions/20240819_definition_daytona workspace.md>), portable [development containers](</definitions/20240819_definition_development container.md>), and a path to low-friction [onboarding](</definitions/20240819_definition_onboarding.md>)

Together, they make that speed practical at team scale.

If your current setup still feels like “wait, then work,” start measuring the handoff time and trim the steps that do not belong in the critical path.

The closer you get to the 200ms mindset, the easier it becomes for humans and agents to keep moving.

## References

- [Daytona documentation](https://www.daytona.io/docs)
- [Daytona workspace definition](</definitions/20240819_definition_daytona workspace.md>)
- [Development container definition](</definitions/20240819_definition_development container.md>)
- [Onboarding definition](</definitions/20240819_definition_onboarding.md>)
- [Dev Containers documentation](https://containers.dev/)
- [GitHub Codespaces documentation](https://docs.github.com/en/codespaces)