Performance, part 7 — Preconnect
As described in previous articles about performance, the time the target browser spends downloading the shared resource is often on the critical path:

This Download step looks like an atomic operation: a single GET request to the file server, with little room left for optimization. Yet one new line of code, a preconnect hint, cut the median download time by 100ms:
<link rel="preconnect" href="https://storage.googleapis.com" crossorigin>
The browser now opens the connection to the file server ahead of time: DNS lookup, TCP handshake, TLS negotiation. When the download starts, the connection is already warm.
![]() |
|---|
| Median download duration of a shared resource by the target browser, in milliseconds |
| Smaller is better |
This directly benefits the user experience: transfers feel even more instant.
In some cases, the preconnect hint makes no difference:
- when a small file goes directly through the Cloud Run app server, the Cloud Storage file server is not involved;
- when the file was already prefetched by the time the user scanned the QR code, there is nothing left to download.
