aboutsummaryrefslogtreecommitdiff
path: root/build/posts/chasing-performance/index.html
diff options
context:
space:
mode:
authorBradley Taunt <bt@btxx.org>2024-06-10 09:41:25 -0400
committerBradley Taunt <bt@btxx.org>2024-06-10 09:41:25 -0400
commit07e4a2dafe248280b5610f8c7d09b0f30b530f54 (patch)
tree8a145d1d4d07e1278a837ff15dadccc322d27515 /build/posts/chasing-performance/index.html
parent16d28628aca9b2d356de31c319f5e7bc0f5b2b02 (diff)
Initial modifications to rebuilt only changed files based on mod date, performance updates
Diffstat (limited to 'build/posts/chasing-performance/index.html')
-rw-r--r--build/posts/chasing-performance/index.html133
1 files changed, 133 insertions, 0 deletions
diff --git a/build/posts/chasing-performance/index.html b/build/posts/chasing-performance/index.html
new file mode 100644
index 0000000..fa4a914
--- /dev/null
+++ b/build/posts/chasing-performance/index.html
@@ -0,0 +1,133 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="dark light">
+ <link rel="icon" href="data:,">
+ <title>Chasing Performance</title>
+ <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
+ <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
+</head>
+
+<nav>
+ <a href="#menu">Menu &darr;</a>
+</nav>
+
+<main>
+<h1 id="chasing-performance">Chasing Performance</h1>
+<p>2017-11-20</p>
+<h2 id="update">Update</h2>
+<p>This post is no longer relevant since this blog has been redesigned since. I&#8217;m keeping this article up as a point of reference.</p>
+<hr/>
+<p>So I decided to participate in Smashing Mag&#8217;s Front End Performance Challenge, not only for the potential of winning the prize but to further experiment with optimizing my site. (Web performance is a passion of mine)</p>
+<p>Below I will breakdown the before &#38; after statistics of my personal site and what changes I made in great detail.</p>
+<p>I will be using both my homepage and the image-heavy article I recently wrote, The Death of Personality, as the basis for my tests.</p>
+<h3 id="lighthouse-score---homepage">Lighthouse Score - Homepage</h3>
+<p>Full source original stats &#47;&#47; Full source updated stats</p>
+<h3 id="lighthouse-score---article-page">Lighthouse Score - Article Page</h3>
+<p>Full source original stats &#47;&#47; Full source updated stats</p>
+<h3 id="web-page-test---homepage">Web Page Test - Homepage</h3>
+<p>Full source original stats &#47;&#47; Full source updated stats</p>
+<h3 id="web-page-test---article-page">Web Page Test - Article Page</h3>
+<p>Full source original stats &#47;&#47; Full source updated stats</p>
+<h3 id="quick-look">Quick Look</h3>
+<p>Though my homepage only made some minor speed performance enhancements, my article post&#8217;s initial load time was slimmed down by a <strong>whopping 4.2 seconds!</strong> That&#8217;s pretty incredible and very noticeable from an end-user&#8217;s perspective.</p>
+<h3 id="so---what-changed">So - What Changed?</h3>
+<p>Webfonts</p>
+<p>I&#8217;m not using any webfonts but instead defaulting to the user&#8217;s OS System Fonts. I love custom typefaces but performance takes just too much of a hit on my personal site to bother with them.</p>
+<pre><code>body {
+font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif,"Sans Serif",Icons;
+}
+</code></pre>
+<p>For reference, there are some things you should to look out for when using custom typefaces:</p>
+<ul>
+<li>Readability and accessibility</li>
+<li>Possible extra overhead loading in a custom @font-face</li>
+<li>Try to avoid any FOUT, FOIT, FOFT</li>
+<li>Don&#8217;t go down the rabbit hole of using 3rd party plugins to optimize something as basic as a typeface</li>
+</ul>
+<h3 id="critical-css">Critical CSS</h3>
+<p>This part was easy. In order to avoid the weird styling &#8216;pops&#8217; present on some websites when initially loading with slow connections, it&#8217;s best to place all your most critical styling inline and then load your external CSS once everything else has loaded.</p>
+<p>On top of that, I decided to also implement Filament Group&#8217;s loadCSS function to load my CSS asynchronously. If you are not currently using this in any of your projects; stop reading this and go do it! It&#8217;s a game changer.</p>
+<h3 id="critical-javascript">Critical JavaScript</h3>
+<p>My personal site only uses a small amount of JavaScript on the article post Jekyll template pages. By using the defer property I can be sure to load the IntersectionObserver API polyfill after the rest of the DOM as finished loading.</p>
+<pre><code>&#60;script src="https:&#47;&#47;cdn.polyfill.io&#47;v2&#47;polyfill.min.js?features=IntersectionObserver" defer&#62;
+</code></pre>
+<p>I could probably optimize this further by only calling these scripts if an image is actually present in the article post, but this fits my needs nicely as is.</p>
+<h3 id="responsive-images">Responsive Images</h3>
+<p>The only images I use are those included in supported blog posts, so the first step was making sure to only call iolazy.min.js on those specific template pages. The next step was defaulting to webp image formats with a lossless jpg fall-back with the help of the picture element:</p>
+<p>I&#8217;ve also included responsive image sizes for further optimization based on screen size and loading speeds.</p>
+<pre><code>&#60;figure&#62;
+&#60;picture
+ &#60;source type="image&#47;webp"
+ data-srcset="
+ &#47;images&#47;articles&#47;webp&#47;flat-design-toggles_p0v2hv_c_scale,w_200.webp 200w,
+ &#47;images&#47;articles&#47;webp&#47;flat-design-toggles_p0v2hv_c_scale,w_1400.webp 1400w"
+ class="lazyload"&#47;&#62;
+ &#60;img
+ sizes="(max-width: 1400px) 100vw, 1400px"
+ data-srcset="
+ &#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_200.webp 200w,
+ &#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_727.webp 727w,
+ &#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_1065.webp 1065w,
+ &#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_1400.webp 1400w"
+ src="&#47;images&#47;placeholder.webp"
+ alt="Toggles Comparison"
+ class="lazyload"&#47;&#62;
+&#60;&#47;picture&#62;
+&#60;&#47;figure&#62;
+</code></pre>
+<p>What about users with JavaScript disabled I hear you ask? It&#8217;s time for noscript to save the day:</p>
+<pre><code>&#60;noscript&#62;
+ &#60;picture&#62;
+ &#60;source type="image&#47;webp"
+ srcset="
+ &#47;images&#47;articles&#47;webp&#47;flat-design-toggles_p0v2hv_c_scale,w_200.webp 200w,
+ &#47;images&#47;articles&#47;webp&#47;flat-design-toggles_p0v2hv_c_scale,w_1400.webp 1400w"&#62;
+ &#60;img
+ sizes="(max-width: 1400px) 100vw, 1400px"
+ srcset="
+ &#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_200.webp 200w,
+ &#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_727.webp 727w,
+ &#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_1065.webp 1065w,
+ &#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_1400.webp 1400w"
+ src="&#47;images&#47;articles&#47;flat-design-toggles_qfre51_c_scale,w_1400.webp"
+ alt="Toggles Comparison"&#47;&#62;
+ &#60;&#47;picture&#62;
+&#60;&#47;noscript&#62;
+</code></pre>
+<h3 id="https-caching">HTTPS &#38; Caching</h3>
+<p>The Lighthouse audit also suggested implementing an SSL certificate (something I&#8217;ve been meaning to do for a while anyway) and also utilize CDN caching. So it was Cloudflare to the rescue!</p>
+<p>Since my website is hosted through Github, setting up a <em>free</em> SSL certificate and enabling site-wide caching was a breeze. If you&#8217;re interested in setting this up yourself, step-by-step instructions can be found here.</p>
+<p>This simple update helped boost my best practices score from a 69 to a 94. Yet another performance enhancement you should be enabling for all your current and future projects!</p>
+<h2 id="performance-happiness">Performance Happiness</h2>
+<p>Overall I&#8217;m pretty content with the <strong>major</strong> performance boost my site has received from these fairly <em>minor</em> updates and I hope this article inspires other designers and developers to jump into updating their own site&#47;app performance speeds. The pay-off is truly worth it!</p>
+<h3 id="some-extra-reading-material">Some Extra Reading Material</h3>
+<ul>
+<li>Web Performance in Action by Jeremy Wagner</li>
+<li>Responsible Responsive Design by Scott Jehl</li>
+<li>Designing with Progressive Enhancement: Building the Web that Works for Everyone by Todd Parker, Scott Jehl,‎ Maggie Costello Wachs,‎ Patty Toland</li>
+</ul>
+<footer role="contentinfo">
+ <h2>Menu Navigation</h2>
+ <ul id="menu">
+ <li><a href="/">Home</a></li>
+ <li><a href="/projects">Projects</a></li>
+ <li><a href="/uses">Uses</a></li>
+ <li><a href="/wiki">Wiki</a></li>
+ <li><a href="/resume">Resume</a></li>
+ <li><a href="/colophon">Colophon</a></li>
+ <li><a href="/now">Now</a></li>
+ <li><a href="/donate">Donate</a></li>
+ <li><a href="/atom.xml">RSS</a></li>
+ <li><a href="#top">&uarr; Top of the page</a></li>
+ </ul>
+ <small>
+ Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br>
+ Maintained with ♥ for the web. <br>
+ Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> &amp; <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br>
+ The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>.
+ </small>
+</footer> \ No newline at end of file