Magento Compilation is good or bad?

Share on:
Magento Compilation is good or bad? | VelsofThe Magento compiler allows the system to compile all the files of a Magento installation to create a single include path that increases the performance level. You can notice the increase between 25%-50% on page loads.

In any Magento development, the speed of loading your pages is the obvious consideration to look forward. I often hear Magento developers saying “I use Magento compiler feature to boost my page loads”. Well! I wondered about the cases when people use it and how much performance is gained? I did some research and found some cases when people were using Magento compiler.

1. When for some reason, their system did not have a PHP Accelerator- A PHP accelerator is a PHP extension which is designed for improving the performance of the PHP software and applications. Most of the PHP accelerator work by caching the compiled opcode/bytecode of PHP files to avoid the overload from parsing and compiling the source code on each request. This cached code is typically stored in shared memory and is executed directly from there. Thus, minimizing the overhead time.

2. When you are running an old version of Magento- This is the case which barely comes in the scene these days. Hopefully, nobody wants to use an outdated version of Magento for running their online store. If in case you are using an outdated version of Magento which does not include the PHP accelerator, then using the Magento compiler is a comparatively wiser idea than using an older version of Magento.

Warning: When should you keep it disabled?

Do you have a system that already has a PHP- accelerator? Is your Magento system showing the version number 1.4 CE or above? If yes; it’s time to know something before you continue.

In the systems already having a PHP -accelerator, or the systems with Magento version 1.4 CE or above, enabling the Magento compiler results into a drawback. It conflicts with the PHP-accelerator which uses the caching of opcode/bytecode of PHP files to avoid the overload from parsing and compiling the source code on each request each time. So, if you are using a system like this, its better you do a proper research first.

During the early release of Magento compilers, claims were made that increases the 25% – 30 % of the performance level. But, after some time , a statement of Yoav Kutner (Magento chief) came which stated something like:

“In later versions since we optimized the catalog EAV, Magento Compilation is not really needed if you have bytecode caching and if it is configured correctly”

So, Why did I mention the Magento compiler if it is not usable anymore?

Magento compiler was presented as a performance improvement feature that can increase the performance level up 25% – 30 %. As this feature is being used widely across the globe it’s worth mentioning here.

The interface for the compiler is located at System >> Tools >> compiler. The Magento compiler is used to transform the PHP codes into – PHP codes !! It’s contrary to fact that compiler is used to transform a high-level language to a machine language.

Here is the case. Magneto posses the source codes which are spread across the large number of modules. Say,

app/code/local/Foo/Module/controller/FooController.php etc.

So, if a PHP search code is used to include these large number of files that are spread across the number of directories, it can create a bottleneck when exposed to the loads. This was the reason when the Magento team included the Magento compiler extension in its codes. This extension was available with default Magento installation till the version number 1.4CE.

How the Magento compiler functions?

The compiler makes the copy of all the classes in your Magento system and places them in a single folder. This is a one-time process. After this, Magento uses the compiler classes in autoload to compile this single folder rather than compiling its normal autoload routine. By doing this, Magento spares the task of traversing the whole file system for all the separately included paths. It reduces the overhead from the PHP search code.

If you are dealing with a large number of files being included on any request in your Magento development, then this will be the case when you will notice a difference in the mode of operation for the Magento compilers and Ppt-code caching. It short, it’s quite different from the Opt-code PHP compiling or caching.

Opt-code PHP compiling/caching and the Magento Compiler, both claims to boost your performance level and have been successful in most of the cases. If you think as a software engineer rather than a PHP developer, both the ways are worth getting familiar with. Neither of the approaches has been proven right or wrong. I have mentioned the way both the approaches work, it just depends on the cases when you have to choose one and you are open to all kinds of solutions for your Magento development.

Share on: