I often see people mention they use the compiler feature of Magento.

I do never and wonder, which cases you should use it and how much performance gain you have then.

[DISCLAIMER]: As I got an edit suggestion about this recently. This question is not about the magento2 di-compile, its not even slightly about magento2.

  • 1
    See my benchmarks with the compiler: byte.nl/blog/should-i-use-the-magento-compiler
    – Willem
    Commented Nov 8, 2014 at 22:03
  • 1
    your apc config is missing, also we now have the opcache module in current versions and there is no supported php version which works with apc anymore. Software changes, so do solutions and workarounds.
    – Flyingmana
    Commented Nov 9, 2014 at 0:20

2 Answers 2


[DISCLAIMER] This answer is only meant for the compiler in Magento 1, the compiler in Magento 2 has a complete different purpose/effect

You should use it never.

Because PHP has developed several mechanics to improve applications containing lots of files.

Means: the php opCache in current php version gives way better performance improvements, if correctly configured. For example to use a high enough limit for cached files. Also the opCache has improvements for functions accessing the filesystem which work on a deeper level then aoe_classpathcache and improves performance even more.

In the end we have an autoloading which does not need more then a few ms without the compiler. There are even cases, where the compiler did harm to performance. Not to mention the crazy time consuming problems to debug applications using the compiler.

also, the opCache does not only improve autoloading, the filesystem function optimizations even improve template and layout file loading.


  • 2
    So, you suggest to disable compilation, clear compiled files, and use opCache instead?
    – perissf
    Commented Jan 11, 2014 at 17:10
  • 1
    if you summarize it, yes
    – Flyingmana
    Commented Jan 11, 2014 at 17:11
  • 3
    The Compiler is a kludge most useful with, and possibly versions. Starting with forward, code optimization started to make it less effectual. Somewhere around 1.6 or 1.7, somebody did A/B testing and found that it can actually slow the system down under certain server configurations. Commented Jan 11, 2014 at 18:34
  • 3
    Two settings for the PHP interpreter to help with the bazillions of files that can be done if you have system access or can get your hosting provider to make the change for you -> realpath_cache_size=64k and realpath_cache_ttl=3600. 64k seems to be the sweet spot, people have recommended more, but performance testing shows it's a waste of memory. Commented Jan 11, 2014 at 18:43
  • 2
    @FiascoLabs Do you have a link/source to your "A/B testing" figures? It would be nice to see. Commented Jan 21, 2015 at 15:00

"When should I use the Magento Compiler"

If for some reason your system does not have a PHP Accelerator installed ( unlikely but possible )

If your running a very old version of magento ( you really shouldn't be )

Why should you keep it disabled ?

I totaly agree with Fiasco Labs comment above. While you didn't give your magento version number, this is true for all magento (CE) versions over 1.6.1, if you enable the compiler on a system that already has a php accelerator ( like PHP-APC etc ) your entire store, from admin pages right through to a customer checking out will be measurably slower, worse yet , many of the plugins/mods you find at the magento connect will not function correctly with compiler active.

In short, in 2014 there is never any good reason to enable the compiler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.