Free your cart, and the speed will follow

Free your cart, and the speed will follow

What if I told you that you can significantly improve the most important performance metric on your Magento site with a few clicks in the admin interface?

This sounds like a bad commercial…” you would surely mumble under your breath (but you would keep reading, because, that’s why bad commercials still exist). And, you would be (partly) correct. Just like in a bad commercial, the initial claim suffers from some ifs and buts. However, there actually is such low hanging fruit in the gardens of Magento performance. Let me take you there.

The ifs and the buts

What is “the most important performance metric on a website”? TTFB (Time To First Byte).
Why? In short, because before the first byte of the requested page arrives, nothing at all happens in the browser. It’s just idle wait time, and users hate that. For the site to (at least) feel fast, it is very important to get that first byte from server to browser as quickly as possible.
What exactly is so slow and can be easily turned off? MAP (Minimum Advertised Price) [http://docs.magento.com/m1/ce/user_guide/catalog/product-price-minimum-advertised.html].
But? It shouldn’t be turned off if you are actually using it.
And, it only matters if the user has something in cart.

Still…

Most sites aren’t using MAP, so chances are you can turn it off. Users often do have something in cart, and you don’t want to irritate them with slowness at that moment. Minicart is usually shown on every page of a Magento site. So, if you can use this optimization, it will really give you the promised significant performance improvements on every page load.

So, what happens that slows the website down?

This little bugger is difficult to cache:

minicart

Magento needs to render it for every user, and when rendering, it needs to call a method named canApplyMsrp for every product in it. And that method is quite slow. However, if you turn off MAP, it is short-circuited, and has no effect on performance, as is shown in the following table:

MAP (0 items in cart)MAP (2 items in cart)MAP (5 items in cart)MAP turned off
Real Project~350~550~850~350
Vanilla RWD~150~400~700~150

Numbers are milliseconds to first byte on homepage. As can be seen, MAP has no effect when nothing is in cart, but, progressively slows down page rendering when items are added to cart. And, if you turn off MAP, the rendering time, no matter how many items in cart, is the same as if there is nothing in it.

How to turn it off?

Make sure you don’t need MAP feature first!

 System / Config / Sales / Minimum Advertised Price / Enable MAP -> No.
 Save Config.

There. Enjoy!

You made it all the way down here so you must have enjoyed this post! You may also like:

Lazy load your images and iframes Danijel Vrgoc
, | 0

Lazy load your images and iframes

Adding custom entries to admin system configuration Tomislav Nikcevski
Tomislav Nikcevski, | 20

Adding custom entries to admin system configuration

Mitigating Facebook’s “x-fb-http-engine: Liger” site hammering using Apache or nginx Drazen Karacic-Soljic
Drazen Karacic-Soljic, | 11

Mitigating Facebook’s “x-fb-http-engine: Liger” site hammering using Apache or nginx

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.