Skip to content

perf(head): optimize initial GitHub API connection using preconnect & dns-prefetch#97

Open
Moamal-2000 wants to merge 1 commit into
Younesfdj:masterfrom
Moamal-2000:perf/add-github-api-preconnect
Open

perf(head): optimize initial GitHub API connection using preconnect & dns-prefetch#97
Moamal-2000 wants to merge 1 commit into
Younesfdj:masterfrom
Moamal-2000:perf/add-github-api-preconnect

Conversation

@Moamal-2000

Copy link
Copy Markdown

Summary

This PR introduces network resource hints (preconnect and dns-prefetch) for https://api.github.com in the root HTML <head>.

Since this app relies heavily on fetching data from the GitHub REST/GraphQL API, establishing the DNS lookup, TCP handshake, and TLS negotiation early during the initial document load significantly reduces connection latency for subsequent network requests.


Changes Made

  • Added <link rel="preconnect" href="https://api.github.com" /> to establish early TLS/TCP connections.
  • Added <link rel="dns-prefetch" href="https://api.github.com" /> as a fallback for legacy browser support.

Expected Impact

  • Reduced TTFB / Latency: Cuts down ~100ms–300ms of connection overhead on initial fetch requests to GitHub's servers.
  • Improved LCP / FCP: Data-dependent components hydrate and render faster on cold starts and slower network connections.

How to Verify

  1. Open Chrome DevTools -> Network tab.
  2. Clear cache and trigger a hard reload (Ctrl + Shift + R).
  3. Inspect the timing waterfall for the first api.github.com request; notice that DNS Lookup, Initial Connection, and SSL phases are resolved in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant