<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Flor Braz on Medium]]></title>
        <description><![CDATA[Stories by Flor Braz on Medium]]></description>
        <link>https://medium.com/@florbraz?source=rss-c441ed619fcb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xAb2BNLOSOlxnn0rXcNgYw.jpeg</url>
            <title>Stories by Flor Braz on Medium</title>
            <link>https://medium.com/@florbraz?source=rss-c441ed619fcb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 00:30:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@florbraz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mobile performance nightmares]]></title>
            <link>https://medium.com/@florbraz/performance-considerations-from-our-latest-e-commerce-project-12c21c1642f?source=rss-c441ed619fcb------2</link>
            <guid isPermaLink="false">https://medium.com/p/12c21c1642f</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[mobile-development]]></category>
            <dc:creator><![CDATA[Flor Braz]]></dc:creator>
            <pubDate>Thu, 16 Oct 2014 22:40:38 GMT</pubDate>
            <atom:updated>2016-01-18T19:22:27.673Z</atom:updated>
            <content:encoded><![CDATA[<p>Don’t turn your page load in mobile networks into a nightmare — some tips about what not to miss in terms of performance in your next responsive website project.</p><p>Recently at <a href="http://itelios.com/">Itelios</a> we developed an e-commerce website for a major worldwide brand (I’m not sure if I’m allowed to tell the name of the brand, so let’s keep it a secret for now) using <a href="http://www.demandware.com/">Demandware</a> technology. The project was executed in a very tight schedule and we’ve had success delivering a great solution for the brand.</p><p>But right after the website was launched, we faced a problem: The site is really image-heavy and loading in mobile networks was a nightmare.</p><blockquote>Big brands can’t lose sales because the consumer is tired of waiting for the page to load in his slow 3G connection.</blockquote><p>Big part of the problem was created by brand’s content team: They had contributed totally non-optimized images. But we’ve had to to admit: We missed some really obvious points, due to the rush and small communication failures. <em>Mea culpa.</em></p><p>In this post I’ll share the points we’re working on to make this website’s pages load faster. I know some things might sound obvious, but maybe it could help other people struggling with this problem. ☺</p><h3>Images</h3><h4><strong>Lossless optimizing contributed images</strong></h4><p>All contributed images need to pass a lossless image optimizer like <a href="https://kraken.io/">https://kraken.io/</a> or <a href="http://thumbor.org/">http://thumbor.org/</a> (my personal favorite, since it can serve .webp images to <a href="https://developers.google.com/speed/webp/faq">supporting browsers</a>, making it really lighter in size). Thumbor needs to be installed and integrated as a webservice in our server, while Kraken can be used manually on the web freely or integrated with Demandware as a paid web service).</p><h4><strong>Lossy compression for photos</strong></h4><p>We have some contributed images in desktop with 150, 250 and even 591kb in size each (591kb is the maximum and It’s just ridiculous). In mobile, there are some some “mobile-sized” images and still they have 196kb.</p><p>For <strong>desktop images</strong>, we need to balance the visual quality with the size and that’s something only the brand’s content team can guarantee. So, we need to train them in this subject.</p><p>For <strong>mobile images</strong>, default recommendation is: save images with double the size (retina screen friendly) but .jpg quality around 20 in Photoshop. This usually does the trick, since the image will be resized to half the size and the flaws of the low-quality photo won’t appear.</p><h4><strong>Every photo should have the mobile version contributed</strong></h4><p>I’ve seen a lot of places in the website where we are using the same image for desktop and mobile, even though the front-end team has integrated responsive images using <a href="http://scottjehl.github.io/picturefill/">Scott Jehl’s Picturefill</a>. Usually mobile will have a smaller picture, in dimensions and file size. We should check the whole site to see where we are really using responsive images and where we aren’t, map this and do the needed modifications in code to make everything available to be contributed for mobile.</p><h4><strong>Lossless optimizing layout images</strong></h4><p>As we should do some lossless optimization in contributed images, we should do in our layout images (even though they already have a fair amount of optimization). We can’t do this in our source images because sometimes, after the lossless compression, the images can’t be further edited in Photoshop/Fireworks. So, ideally we’d have the same script that optimized contributed images to do the optimization on our layout images, but only on production environment.</p><h3>Minify and Concatenate</h3><h4><strong>Minification</strong></h4><p>We should minify all CSS and JS in the production website. This is something that <strong>made me cry</strong> when I saw we weren’t doing, because it’s pretty basic and also, right at the begginning of the project, I asked some of the back-end developers and they told me that it would be automatically done in production environment. Turns out it wasn’t. ☹</p><h4><strong>Concatenation</strong></h4><p>Right now all the css and js files are being served on it’s own. That means lots of requests. I think in every page, we could have only two css and two js (maybe four, if the page needs some scripts files at the top of the page and some at the bottom). One for all the css and js that are loaded on the “masterpage”, concatenated, and one for the css and js that are loaded in the navigation/script and navigation/css, concatenated. This way we’ll save some requests at each page load.</p><h3>Lazy Load</h3><p>In an image-heavy website as this one is, images should only be loaded as we see them in the viewport. Implementing some kind of lazy loading will greatly improve loading time of the rest of the page.</p><h3>Scripts at the bottom of the page</h3><p>Right now, only some of the scripts are in the bottom of the page, right before closing &lt;/body&gt;. We need to analyze which scripts that are loading at the &lt;head&gt; can be transfered to the end of the page, so content is visible first.</p><h3>Watch duplicate assets</h3><h4>Duplication during contribution</h4><p>I saw that in the home page we are loading the files from font-face one time from the website (css) and another time from the CDN. This was generated by the brand during html content contribution. We need to train them into analysing our code and finding what is already there.</p><h4>Different scripts doing the same thing</h4><p>The main banner in the home page (contributed by brand’s front-end team) uses a different plugin from the one we already use for other sliders in the page. It’s perfectly possible to achieve the same result using the plugin that is already in the page. We just need to teach them how to. ☺</p><h3>Asychronous javascript load</h3><p>Defer scripts and load them asynchronously whenever possible (don’t forget to <a href="http://caniuse.com/#search=async">check crossbrowser compatibility</a> for those items and issue the problems)</p><p>Defer: script is executed when the page has finished parsing.<br>Defer + Async = The script is executed asynchronously with the rest of the page (the script will be executed while the page continues the parsing)</p><h3>Set cache in HTTP headers</h3><p>Basically we only need to change cache rules for the .svg files in our domain. Apparently this is out of Demandware’s default cacheing rules.</p><h3>And last, but not least: Analyze the “common” JS file</h3><p>Do all of this code really needs to be loaded in every single page of this website? D:</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12c21c1642f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>