With PrestaShop 1.7, our main purposes were to improve the user experience on the Product Creation page and the Modules page, and also to make it easier to create a front office theme.
As you may know, version 1.7 now includes the Symfony2 framework. If you were afraid that it may slow PrestaShop down, be sure we wanted to avoid that and even do better than PrestaShop 1.6.1.x in terms of Performances! In order to prove that, here are a few statistics.
To make the comparison, we took PrestaShop 22.214.171.124 and PrestaShop 1.7 from GitHub, with data from a real shop:
- 1,827 categories
- 10,843 cart rules
- 1,904 products
- 2 million product attributes
- 16.5 million attribute
The server configuration used is the same as in our v126.96.36.199 performances article from July 2015.
Why is it interesting to compare the front office performances? Because we made a lot of changes there!
We have completely rewritten the .tpl files as well as many of the front controllers. We also changed the way assets are managed. For instance, there is now only one CSS file and only one JS file by default for the theme, in order to reduce the number of HTTP requests. Modules can always load their own CSS files, and it’s up to theme developers to compile the assets (using Webpack, for instance).
Let’s look at some figures comparing PrestaShop 188.8.131.52 and PrestaShop 184.108.40.206 RC3:
|Number of lines|
|Number of files|
|Size of files (kb)|
While showing the number or size of PHP files is not a very useful in terms of performances, the decrease in number of PHP files shows that team has worked hard in simplifying controllers and removing old code.
Likewise, the size of TPL files does not speak much in terms of performances since they will be compiled, but the increase of their number shows they are better subdivised.
By removing and rewriting a lot of code lines, we have succeeded in getting the following results to load these front office pages:
We can see here an increase of server memory consumption (+33%) and loading time (+48%, but it’s just 40 milliseconds ).
It’s not necessarily a bad thing because we know where it comes from and it’s for the best: we now send the same product on every page type, with the same data (product listing, product page, cart, etc.). Thus, we now have a consistency of product data available across all pages, and we can now focus on optimizing that part.
Also, we now load all the CSS files for the entire website. The homepage is the first one we see, which explains why the loading time is higher here. It will be faster afterwards, since the necessary JS and CSS files are from now on in the browser cache.
Here the results are almost even, except for a slight increase of server memory consumption (+9%). The reason for this is the same as on the homepage: we now load all the products’ data.
It’s the most important part, the one you want to be indexed by the search engines. We are 17% faster, which may improve your SEO ranking.
Globally, the number of rendered pages in 20 seconds with a variable number of connections have been increased.
Product page in back office
The front office was not our only focus. We wanted to put a definitive end to the “spinning save button” issue on the Product Creating page, which was caused by the loading of all the product’s combinations.
To prevent that, we chose to load the combinations 5 by 5 in Ajax. You can still edit the loaded combinations even if they are not all loaded the bulk action is simply disabled while the rest of the combinations are loading.
Because we completely reworked the Modules page, we can’t easily compare with the 1.6 version of this page.
Nevertheless, we improved the behavior when the user is trying to install a module causing a fatal error: simply put, it shouldn’t break your shop anymore! PrestaShop now analyzes the code to detect parsing errors, and if an error occurs during the installation, the module will be kept on your disk but it won’t be installed.
What to make of this
One of our objectives with 1.7 and its technical changes (the inclusion of the Symfony, the new way Themes work, etc.) was to give users AT LEAST the same performances on the three upgraded areas: the front office, the Product Creation page, and the Modules page.
As the above graphics show you, we mostly succeeded in having not only equal, but sometimes BETTER performances overall! There are situations where the percentage are slightly not in our favor, but they can be explained by features in favor of developers, and therefore, in the end, in favor of merchants and users.
We’re not done improving the performances of PrestaShop 220.127.116.11, and we’ll keep looking at bottlenecks in order to fix them!