I am sometimes questionned about the performance of Polylang. Is Polylang responsible for my slow website? Polylang adds a language switcher widget and does filter all the frontend content according to the requested language. So yes, Polylang impacts the performance of the website. How much? And how it compares to other multilingual plugins?
I have tested Polylang 1.3.1 and two other multilingual plugins, WPML 18.104.22.168 and qtranslate 2.5.38, as well as WordPress alone.
The test protocol is as follows. Everything is done on a local install with XAMPP 1.8.1 (PHP 5.4 + MySQL 5.5) + WP 3.7.1 + Twenty Twelve. No other plugin is activated. Google fonts are disabled in Twenty twelve so that no HTTP request is sent to the internet. Each test site has five posts (with random text) in three categories, one page, a custom menu displaying categories and several widgets (the language switcher, search, archives, categories, pages, recent posts, meta). The number of displayed posts is set to 5, permalinks are set to %postname% and the urls are modified to have the language code as a directory. The default language is English (en_US) and it does not display the language code. Everything is translated in French (fr_FR).
The pages are requested with Apache bench 10 times each. I tested the home page, one page, one category archive, one monthly archive and one post. If one result in the serie is far above the others, the test is rerun as it probably means that WP-CRON has run during a request.
Here are the first results when querying the English version (no .mo file is loaded). Figures reported are average total time per request in ms:
|Non localized (en_US)||WP alone||Polylang||qtranslate||WPML|
As loading .mo files is known to impact the WordPress performance a lot, I ran a second series of tests querying the translated pages. Here the French .mo files are loaded (including for the site with no plugin for which WP_LANG is set to ‘fr_FR’ in this serie).
|Localized (fr_FR)||WP alone||Polylang||qtranslate||WPML|
This second serie of tests confirms the impact performance of loading .mo files (even if here there is no or only one plugin). In all tests done, Polylang is always the fastest solution. The table below summarizes the impact performance of each plugin compared to a website running no plugin.
We can see that Polylang 1.3.1 impacts the permance of an almost fresh WordPress by an average of about 16%. This impact is doubled if you use qTranslate 2.5.38 and doubled again if you use WPML 22.214.171.124.
NB1: Of course, I am not a customer of WPML so I tested the last version which was free of charge. It as been released almost three years ago and tested up to WP 3.0.5. So clearly, the test is not fair as first, I ran it with a version of WordPress which has never been tested by the authors (but the job is done), and second, the WPML team may have improved their plugin performance since that time. I would be very happy to see such kind of performance results with a recent version of WPML.
NB2: Of course, these tests are most probably not representative of a real website, as it is likely that other plugins are used and I guess that every webmasters caring of their site performance uses a cache plugin, which was not the case for this test. Once the page is cached and served directly by Apache, there is no more difference between plugins.
NB3: This is not an independant test!