# The eye in a worker

> The eye draws from a web worker, on a canvas handed off the main thread. While its shaders build, the page stays free to respond.

- URL: https://www.kiruk.in/making/worker-host
- Kind: Pattern
- Made: 29 Oct 2026
- Author: Arun Kumaar Sreenivasan
- Part of: How this was made (https://www.kiruk.in/making)
- Agent file: https://www.kiruk.in/making/worker-host/agent.md

## The problem

Building the eye's shaders is heavy work. On the main thread that work competes with everything else a page does in its first seconds, and the visitor's first tap waits behind it. On a throttled phone the worst tap took 4.1 s.

## The move

Hand the canvas to a worker and run the whole eye there. The page sends it small messages: the pointer, the era, the size of the window. The worker sends frames.

To make that possible the eye never talks to the page directly. It talks to a host, and there are two: one that is the page, and one that is a worker. The same eye runs on either.

| On a throttled phone | On the page | In a worker |
| --- | --- | --- |
| Worst interaction | 4.1 s | 0.73 to 1.15 s |
| Long tasks while the eye builds | 4 to 5 | 0 |

Measured 29 October 2026, dev build, 4× CPU throttle.

## What it did not fix

The target was under 200 ms and it was missed. The tasks that remain come from the page hydrating under the loader, not from the eye. That is the next piece of work, and it is not done.

## Lineage

### Used by

- [The loader eye](https://www.kiruk.in/making/loader-eye) (Interface, May to Nov 2026): One human eye, drawn live in the browser and lit only by the screen it is looking at. It was built four times in six months, measured against a photograph of my own eye, and it changes era by blinking.
