<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Farzan</title>
    <description>The latest articles on DEV Community by Muhammad Farzan (@muhammadfarzan0).</description>
    <link>https://dev.to/muhammadfarzan0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4057934%2F1b8478ae-e55b-4f1f-a685-04872e0fb26d.jpg</url>
      <title>DEV Community: Muhammad Farzan</title>
      <link>https://dev.to/muhammadfarzan0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammadfarzan0"/>
    <language>en</language>
    <item>
      <title>Building Fast Websites for Pakistan's Real Network Conditions (Not Just a Lighthouse Score)</title>
      <dc:creator>Muhammad Farzan</dc:creator>
      <pubDate>Sat, 01 Aug 2026 12:19:34 +0000</pubDate>
      <link>https://dev.to/muhammadfarzan0/building-fast-websites-for-pakistans-real-network-conditions-not-just-a-lighthouse-score-1lah</link>
      <guid>https://dev.to/muhammadfarzan0/building-fast-websites-for-pakistans-real-network-conditions-not-just-a-lighthouse-score-1lah</guid>
      <description>&lt;p&gt;It's easy to test a site on office fibre, get a 95+ Lighthouse score, and call performance "done." Then someone in a secondary city mentions the site feels slow on their phone, and the gap between &lt;em&gt;tested&lt;/em&gt; performance and &lt;em&gt;real&lt;/em&gt; performance becomes obvious.&lt;/p&gt;

&lt;p&gt;This isn't a Pakistan-specific problem in theory, but it's an unusually common one in practice — a large share of real users here are on congested 3G or throttled 4G, on mid-range Android devices, often outside the main metros where infrastructure is best. If you're building for a Pakistani (or generally emerging-market) audience, "works great in the office" isn't the same as "works great for the actual user."&lt;/p&gt;

&lt;p&gt;Here's what actually moves the needle, beyond just plugging in a CDN.&lt;/p&gt;

&lt;h2&gt;
  
  
  A CDN helps, but it doesn't fix the last mile
&lt;/h2&gt;

&lt;p&gt;A CDN gets your assets physically closer to the user, which helps. But if the connection between someone's phone and the nearest edge node is still a congested 3G link, the CDN's job is basically done — the bottleneck is the last mile, and no amount of edge-caching fixes that. What actually helps is reducing how much has to travel down that last mile in the first place.&lt;/p&gt;

&lt;p&gt;That reframes the whole problem: less about "getting bytes there faster" and more about "sending fewer bytes."&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Image weight is usually the biggest offender
&lt;/h2&gt;

&lt;p&gt;Images are typically the single largest contributor to page weight, and the fix isn't exotic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Next.js example — explicit width/height prevents layout shift,&lt;/span&gt;
&lt;span class="c1"&gt;// and the Image component serves modern formats automatically&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/image&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Image&lt;/span&gt;
  &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/hero.jpg"&lt;/span&gt;
  &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Product hero shot"&lt;/span&gt;
  &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1200&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;630&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;priority&lt;/span&gt; &lt;span class="c1"&gt;// only for above-the-fold images&lt;/span&gt;
&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few concrete habits that add up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Serve &lt;strong&gt;WebP/AVIF&lt;/strong&gt; instead of raw JPEG/PNG where you can — usually 25-50% smaller at equivalent visual quality&lt;/li&gt;
&lt;li&gt;Always set explicit &lt;code&gt;width&lt;/code&gt;/&lt;code&gt;height&lt;/code&gt; (or use a framework component that does it for you) so the browser doesn't shift layout while images load — this also directly affects your Cumulative Layout Shift score&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lazy-load anything below the fold.&lt;/strong&gt; No reason to spend bandwidth loading images a visitor may never scroll to&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On one e-commerce rebuild, tightening just the image pipeline (format, lazy-loading, explicit dimensions) cut total page weight by roughly a third — without touching the design at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Audit every third-party script like it's costing you money (because it is)
&lt;/h2&gt;

&lt;p&gt;Every third-party script — chat widgets, analytics, marketing pixels, embedded social widgets — adds parse and execution time on the client, and that cost is disproportionately higher on a low-end device than on a developer's laptop. A script that "feels instant" in Chrome DevTools on fibre can visibly block interactivity on a budget Android phone over 3G.&lt;/p&gt;

&lt;p&gt;A simple audit habit: open your Network tab, filter by JS, and sort by size. For anything you don't immediately recognize the purpose of, ask whether it's actually earning its cost. Defer what you can:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Bad: blocks parsing immediately --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://widget.example.com/embed.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Better: doesn't block initial render --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://widget.example.com/embed.js"&lt;/span&gt; &lt;span class="na"&gt;defer&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For anything genuinely non-critical (most chat widgets, most marketing pixels), loading it &lt;em&gt;after&lt;/em&gt; the main content is interactive — rather than in the critical path — is usually the single highest-leverage JS change you can make.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Self-host your fonts
&lt;/h2&gt;

&lt;p&gt;Pulling fonts from a third-party CDN (Google Fonts' default embed being the most common example) adds an extra DNS lookup and connection round-trip before a single font file even starts downloading. Self-hosting removes that hop entirely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example using @fontsource (self-hosted font packages)&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@fontsource/inter/400.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@fontsource/inter/600.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Combine this with &lt;code&gt;font-display: swap&lt;/code&gt; so text renders immediately in a fallback font instead of staying invisible while the custom font downloads (avoiding the classic "flash of invisible text"):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@font-face&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Inter"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;src&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url("/fonts/inter.woff2")&lt;/span&gt; &lt;span class="n"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;"woff2"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="py"&gt;font-display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;swap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small change, consistently measurable improvement in Largest Contentful Paint on slow connections.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Measure on throttled connections, not just fibre
&lt;/h2&gt;

&lt;p&gt;Chrome DevTools has a built-in network throttling option ("Slow 3G" / "Fast 3G" presets under the Network tab) — genuinely underused. Testing your actual build under simulated 3G, rather than trusting a Lighthouse score generated on a fast connection, surfaces problems a lab score can hide. PageSpeed Insights' "Field Data" section (when available) is even more useful — it's based on real Chrome User Experience Report data from actual visitors, not a synthetic lab run.&lt;/p&gt;

&lt;h2&gt;
  
  
  None of this is exotic — that's the point
&lt;/h2&gt;

&lt;p&gt;Nothing above is a clever trick. It's mostly discipline about what gets added to a page and when it loads. But that discipline is the actual difference between a site that scores well in a lab test and one that feels fast to someone on a real 3G connection in a city outside the main metros — which, for a lot of products built here, is a large and easy-to-forget part of the real audience.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I run &lt;a href="https://webtechsolutions.dev" rel="noopener noreferrer"&gt;WebTech Solutions&lt;/a&gt;, a web development studio based in Rawalpindi, Pakistan — we build for clients across Pakistan, the UK, the US, the UAE, and Saudi Arabia. A lot of the discipline above came from building specifically for lower-bandwidth conditions, but it holds up everywhere. &lt;a href="https://webtechsolutions.dev/case-studies/brave-gym" rel="noopener noreferrer"&gt;Here's an example&lt;/a&gt; of a recent Next.js build where performance was a deliberate priority, not an afterthought.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
