A fast loading website is the goal of every shop owner, as a slow website can lead to a long list of issues, from disappointed customers who lose patience and abandon their cart, to an overloaded server that stops working, and search engines penalizing your site's ranking due to speed.

After helping countless PrestaShop sites optimize and increase their speed, including adding timers around different parts of PrestaShop and analyzing what is taking long and why, we have decided to share our obvious and no-so-obvious findings, and help the entire PrestaShop community.

Caching & CCC

PrestaShop has several layers of caching, we'll start with the ones on the Performance page

* Smarty (Template compilation) Should be set to "Recompile templates if the files have been updated" - This will make sure PrestaShop uses smarty cache at all times, and only recompiles a file if it was changed.

* Cache (Caching type) Should be turned on, with File System selected.

* CCC (Available on certain PS version) We recommend turning OFF Minify HTML and Compress inline JavaScript in HTML - We noticed PrestaShop was spending a long time (sometimes several seconds) when these features are enabled, which means that any benefit from the compression is more than negated by the slow speed.

* Ciphering (Available on certain PS versions) We recommend selecting the "Use the custom BlowFish class" - We found that when the server load was high, saving a cookie on the client side with Mcrypt was taking up to several seconds (due to an issue with randomly encrypting the cookie). Switching to blowfish kept the cookie saving time to a few miliseconds.

* Caching (Bottom of the performance page) We recommend turning OFF, as we have seen this feature cause more trouble than offer benefit, with module settings not being updated, and other unexpected behavior.

* Install a server side caching system, such as OPCache, you would have to check with your hosting provider to see if it's available, and if they can activate it on your website (You may need to reset the cache after making changes to PHP files, in order for the changes to apply right away.

Email

* SMTP We highly recommend NOT using a 3rd party SMTP server, we have seen speeds of up to 3-5 seconds sending a single email using a 3rd party SMTP server.

* PHP mail() We recommend using this option, however, even with this option selected, we noticed that some versions of PrestaShop had a slow send time (1-2 seconds) due to the Swift version that was installed. If you are using PS 1.5, or even an early version of PS 1.6, you may want to make sure sending emails is not taking a long time (Normal time should be around 0.2 seconds.)

Modules / Customizations

* Shipping / Tax If you are using any 3rd party modules or services, such as UPS, FedEx, TaxCloud or Avalara, PrestaShop will make API calls whenever a product is added to the cart, and even if they have proper caching in place to avoid making the same API request more than one time, it will still require an API for each new product added, and can take several seconds to do so. Whenever possible, use fixed shipping rates, and if you must use those 3rd party services, we recommend making changes to only calculate taxes and shipping when the customer gets to the checkout page.

* Carousel If you are using a product carousel module or customization, or similar upsell / product recommendation that is reading product information to display it, make sure they are using a caching system to avoid doing identical calls to the database that return the same data, and take a long time to run. If you are not sure about their caching, ask the developer, or try to disable the module and compare page speed.

Database

* Analyze & Repair Databases can get corrupted at times, which will result in queries taking longer. It is recommended to periodically check and repair your database tables, this can be easily done from PHPMyAdmin, by selecting all the tables, and choosing the "Check" option at the bottom. If you see any tables with errors, select them and choose the "Repair" option.

Connections PrestaShop keeps visitor information for statistic purposes in 3 tables, and actively queries ps_connections before writing to it, which can take a long time if the tables gets really big, that in turn can lock up the database, and delay the time it takes for the page to load for all the visitors. We recommend backing up and clearing this table once a year, or sooner for sites with a large number of visitors (Try keeping the table size to less than 500,000 records).

ReCaptcha

* Google ReCaptcha We noticed a substantial slowdown in the time the front end page finishes loading (sometimes taking 5-7 seconds). We recommend restricting the ReCaptcha code to a specific page (like contact form) rather than enable it for all page loads (in case there's a newsletter signup form in the footer).

Miscellaneous

* Debug Profiling There could be other things that cause your website to be slow, and the best way to get more information and identify the culprit is by enabling the Debug_Profiling variable in /config/defines.inc.php (Change from "False" to "True". This will generate a report in the front end with exact timing of every part in PrestaShop, including every Database query. You will have to inspect the report and identify any parts that are slow.

Keep in mind that this will show up for all visitors, so make sure you only change it for your IP address, unless you are working on a development environment.