{"id":3253,"date":"2017-12-18T16:33:41","date_gmt":"2017-12-18T16:33:41","guid":{"rendered":"https:\/\/coloredcow.com\/?p=3253"},"modified":"2026-02-03T03:05:24","modified_gmt":"2026-02-03T03:05:24","slug":"code-changes-added-value-us","status":"publish","type":"post","link":"https:\/\/coloredcow.com\/code-changes-added-value-us\/","title":{"rendered":"How a few code changes added more value to us"},"content":{"rendered":"<h2><span style=\"font-size: 18pt;\"><strong>From here:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3260\" src=\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before-1024x318.jpg\" alt=\"\" width=\"1024\" height=\"318\" srcset=\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before-1024x318.jpg 1024w, https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before-300x93.jpg 300w, https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before-768x239.jpg 768w, https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before.jpg 1970w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/strong><\/span><\/h2>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-size: 18pt;\"><strong>To here:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3259\" src=\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-after-1024x322.jpg\" alt=\"\" width=\"1024\" height=\"322\" srcset=\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-after-1024x322.jpg 1024w, https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-after-300x94.jpg 300w, https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-after-768x242.jpg 768w, https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-after.jpg 1970w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/strong><\/span><\/h2>\n<p>&nbsp;<\/p>\n<p>And we were able to do that with a few code changes that literally involved rearranging a few lines. Don&#8217;t believe it? Read further.<\/p>\n<p>&nbsp;<\/p>\n<p>When I found out that the home page of our site was 1.8MB, I was shocked. Literally. Even with zero images (which generally occupy more than 50% of the total page size), our page was so big. How was it possible? After digging a bit, I found out that fonts were taking 1.6MB! Yes, no one would believe that! Who uses web fonts that take around 90% of the page size? I thought that some fonts which weren&#8217;t even required were being loaded. That was the best guess I did then.<\/p>\n<p>So I moved forward with my guess until I found out that I was wrong. CSS is also optimized in the core, so it only loads the fonts which are being used at least in one place. Digging up more,\u00a0from the Chrome inspector, I found that each font was occupying almost 200KB (there were about 4-5 like this) and one special font with 450KB. Found the culprits!<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-size: 18pt;\"><strong>Reading about the bad guys<\/strong><\/span><\/h2>\n<p>Researching more, I found that we were mostly using OTF and TTF font types. WOFF types are generally smaller and use ZLIB compression. Moving to the code, I found the following snippet:<\/p>\n<pre class=\"lang:css decode:true \">@font-face {\r\n    font-family: 'Roboto-Regular';\r\n    src: url('fonts\/Roboto-Regular.eot?#iefix') format('embedded-opentype'),\r\n         url('fonts\/Roboto-Regular.ttf') format('truetype'),\r\n         url('fonts\/Roboto-Regular.otf') format('opentype'),\r\n         url('fonts\/Roboto-Regular.woff') format('woff');\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>See, the browser reads the code from the first URL. Whatever format the browser finds supportable, it&#8217;ll pick that up and won&#8217;t process any further. And none of the browsers were going beyond OpenType. So, I did some line rearrangements and the new code was:<\/p>\n<pre class=\"lang:default decode:true \">@font-face {\r\n    font-family: 'Roboto-Regular';\r\n    src: url('fonts\/Roboto-Regular.woff') format('woff'),\r\n         url('fonts\/Roboto-Regular.eot?#iefix') format('embedded-opentype'),\r\n         url('fonts\/Roboto-Regular.ttf') format('truetype'),\r\n         url('fonts\/Roboto-Regular.otf') format('opentype');\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>What did I do? Just made sure whichever browsers support WOFF, they pick that up and don&#8217;t move further. The browser not\u00a0supporting the first three will pick up the fourth. And chances are rare that people use those crappy browsers.<\/p>\n<p>Similar changes in a few more font definitions and the page size reduced to 400KB. <strong>The page loads instantaneously now adding direct value as visitors over a slower network are now more likely to stay and read about us.<\/strong><\/p>\n<h2><\/h2>\n<h2><span style=\"font-size: 18pt;\"><strong>What&#8217;s next?<\/strong><\/span><\/h2>\n<p>Yes, it&#8217;s not done yet. 400Kb is still too large for a page with no images. See that Requests box there? 38 requests? What the @#%$! Definitely, need to reduce that. It&#8217;ll also help reduce the load time (3.37s is far from ideal).<\/p>\n<p>&nbsp;<\/p>\n<p>Tools I used that you may find useful:<\/p>\n<ul>\n<li>Speed test: <span style=\"text-decoration: underline; color: #33cccc;\"><a href=\"https:\/\/tools.pingdom.com\" target=\"_blank\" rel=\"noopener\">Pingdom Website Speed Test<\/a><\/span><\/li>\n<li>Didn&#8217;t stick to one performance tool. I cross verified before\/after results at <span style=\"text-decoration: underline;\"><span style=\"color: #33cccc; text-decoration: underline;\"><a href=\"https:\/\/gtmetrix.com\/\">GTMetrix<\/a><\/span><\/span> also.<\/li>\n<li>Font conversions: <span style=\"text-decoration: underline;\"><a href=\"https:\/\/www.fontsquirrel.com\/tools\/webfont-generator\">FontSquirrel&#8217;s Font Generator<\/a><\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>From here: &nbsp; &nbsp; To here: &nbsp; And we were able to do that with a few code changes that literally involved rearranging a few lines. Don&#8217;t believe it? Read further. &nbsp; When I found out that the home page of our site was 1.8MB, I was shocked. Literally. Even&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[86,83],"tags":[],"class_list":["post-3253","post","type-post","status-publish","format-standard","hentry","category-development-practices","category-processes"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How a few code changes added more value to us - ColoredCow<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/coloredcow.com\/code-changes-added-value-us\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How a few code changes added more value to us - ColoredCow\" \/>\n<meta property=\"og:description\" content=\"From here: &nbsp; &nbsp; To here: &nbsp; And we were able to do that with a few code changes that literally involved rearranging a few lines. Don&#8217;t believe it? Read further. &nbsp; When I found out that the home page of our site was 1.8MB, I was shocked. Literally. Even...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/coloredcow.com\/code-changes-added-value-us\/\" \/>\n<meta property=\"og:site_name\" content=\"ColoredCow\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ColoredCow-1625325751018012\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-18T16:33:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-03T03:05:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1970\" \/>\n\t<meta property=\"og:image:height\" content=\"612\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Vaibhav Rathore\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vaibhav Rathore\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/\"},\"author\":{\"name\":\"Vaibhav Rathore\",\"@id\":\"https:\/\/coloredcow.com\/#\/schema\/person\/15c109017f439c778c807d106aab7543\"},\"headline\":\"How a few code changes added more value to us\",\"datePublished\":\"2017-12-18T16:33:41+00:00\",\"dateModified\":\"2026-02-03T03:05:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/\"},\"wordCount\":442,\"image\":{\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before-1024x318.jpg\",\"articleSection\":[\"Development Practices\",\"Processes\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/\",\"url\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/\",\"name\":\"How a few code changes added more value to us - ColoredCow\",\"isPartOf\":{\"@id\":\"https:\/\/coloredcow.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before-1024x318.jpg\",\"datePublished\":\"2017-12-18T16:33:41+00:00\",\"dateModified\":\"2026-02-03T03:05:24+00:00\",\"author\":{\"@id\":\"https:\/\/coloredcow.com\/#\/schema\/person\/15c109017f439c778c807d106aab7543\"},\"breadcrumb\":{\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/coloredcow.com\/code-changes-added-value-us\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/#primaryimage\",\"url\":\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before.jpg\",\"contentUrl\":\"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before.jpg\",\"width\":1970,\"height\":612},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/coloredcow.com\/code-changes-added-value-us\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/coloredcow.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How a few code changes added more value to us\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/coloredcow.com\/#website\",\"url\":\"https:\/\/coloredcow.com\/\",\"name\":\"ColoredCow\",\"description\":\"End-to-end technology partner from India&#039;s Himalayan region. Custom software, web, mobile &amp; AI solutions \u2014 headquartered in Uttarakhand and Gurugram since 2014.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/coloredcow.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/coloredcow.com\/#\/schema\/person\/15c109017f439c778c807d106aab7543\",\"name\":\"Vaibhav Rathore\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/coloredcow.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/137ab0a683085f09d12b2ecdc4e4619b99eeb27eda5733381e757905cfa986be?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/137ab0a683085f09d12b2ecdc4e4619b99eeb27eda5733381e757905cfa986be?s=96&d=mm&r=g\",\"caption\":\"Vaibhav Rathore\"},\"url\":\"https:\/\/coloredcow.com\/author\/vaibhav\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How a few code changes added more value to us - ColoredCow","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/coloredcow.com\/code-changes-added-value-us\/","og_locale":"en_US","og_type":"article","og_title":"How a few code changes added more value to us - ColoredCow","og_description":"From here: &nbsp; &nbsp; To here: &nbsp; And we were able to do that with a few code changes that literally involved rearranging a few lines. Don&#8217;t believe it? Read further. &nbsp; When I found out that the home page of our site was 1.8MB, I was shocked. Literally. Even...","og_url":"https:\/\/coloredcow.com\/code-changes-added-value-us\/","og_site_name":"ColoredCow","article_publisher":"https:\/\/www.facebook.com\/ColoredCow-1625325751018012\/","article_published_time":"2017-12-18T16:33:41+00:00","article_modified_time":"2026-02-03T03:05:24+00:00","og_image":[{"width":1970,"height":612,"url":"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before.jpg","type":"image\/jpeg"}],"author":"Vaibhav Rathore","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Vaibhav Rathore","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/#article","isPartOf":{"@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/"},"author":{"name":"Vaibhav Rathore","@id":"https:\/\/coloredcow.com\/#\/schema\/person\/15c109017f439c778c807d106aab7543"},"headline":"How a few code changes added more value to us","datePublished":"2017-12-18T16:33:41+00:00","dateModified":"2026-02-03T03:05:24+00:00","mainEntityOfPage":{"@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/"},"wordCount":442,"image":{"@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/#primaryimage"},"thumbnailUrl":"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before-1024x318.jpg","articleSection":["Development Practices","Processes"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/","url":"https:\/\/coloredcow.com\/code-changes-added-value-us\/","name":"How a few code changes added more value to us - ColoredCow","isPartOf":{"@id":"https:\/\/coloredcow.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/#primaryimage"},"image":{"@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/#primaryimage"},"thumbnailUrl":"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before-1024x318.jpg","datePublished":"2017-12-18T16:33:41+00:00","dateModified":"2026-02-03T03:05:24+00:00","author":{"@id":"https:\/\/coloredcow.com\/#\/schema\/person\/15c109017f439c778c807d106aab7543"},"breadcrumb":{"@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/coloredcow.com\/code-changes-added-value-us\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/#primaryimage","url":"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before.jpg","contentUrl":"https:\/\/coloredcow.com\/wp-content\/uploads\/2017\/12\/screenshot-before.jpg","width":1970,"height":612},{"@type":"BreadcrumbList","@id":"https:\/\/coloredcow.com\/code-changes-added-value-us\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/coloredcow.com\/"},{"@type":"ListItem","position":2,"name":"How a few code changes added more value to us"}]},{"@type":"WebSite","@id":"https:\/\/coloredcow.com\/#website","url":"https:\/\/coloredcow.com\/","name":"ColoredCow","description":"End-to-end technology partner from India&#039;s Himalayan region. Custom software, web, mobile &amp; AI solutions \u2014 headquartered in Uttarakhand and Gurugram since 2014.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/coloredcow.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/coloredcow.com\/#\/schema\/person\/15c109017f439c778c807d106aab7543","name":"Vaibhav Rathore","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/coloredcow.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/137ab0a683085f09d12b2ecdc4e4619b99eeb27eda5733381e757905cfa986be?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/137ab0a683085f09d12b2ecdc4e4619b99eeb27eda5733381e757905cfa986be?s=96&d=mm&r=g","caption":"Vaibhav Rathore"},"url":"https:\/\/coloredcow.com\/author\/vaibhav\/"}]}},"_links":{"self":[{"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/posts\/3253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/comments?post=3253"}],"version-history":[{"count":19,"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/posts\/3253\/revisions"}],"predecessor-version":[{"id":3278,"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/posts\/3253\/revisions\/3278"}],"wp:attachment":[{"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/media?parent=3253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/categories?post=3253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coloredcow.com\/wp-json\/wp\/v2\/tags?post=3253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}