Understanding Process of compilation and cache

I need to understand what is actually process done by compilation ? how can it help to speed up magento site. Why we are not able to install extension when compilation is in enable mode.

Also need to understand about cache what is process the actually done by catch and how can it improve speed of site loading time.

Solutions

The compilation in Magento is different than classic code compilation like in C or Java. The compilation process doesn't reduce the file size, neither does it transform the PHP code into a machine code, it just creates hard copy of all classes from all magento modules (core and custom) into a single folder so that the autoloader can load them faster (instead of traversing a big number of folders and subfolders to reach to it). The copies are stored inside the includes folder.

If you have activated the compiler, magento will search for the classes only in the includes folder. And if you install a new module whyle the compiler is activated, it won't automatically create a copy of the new classes inside the include folder, so it won't find the module classes. That's why you need to recompile everytime you change or add any class in any magento module.

You can find more details about the compiler on Alan Storm's blog http://alanstorm.com/magento_compiler_path

For caching, you can read this related question and answers https://stackoverflow.com/questions/9283279/explain-magento-caching-system

Tags: Magento 1.x / Cache

Similar questions

LESS compilation (Grunt) or cache issue
I have started using Grunt, but encountered an issue. I am trying to change styles in custom theme via one of the LESS files, but nothing happens. It worked once, but it doesn't now, and I don't know why. Task: change _grid-col.less Result expected: style change on front-end. Current result: style changes on front-end from an earlier customization ...
Magento 2 Varnish cache compilation failed
I configuring the Varnish cache in Magento 2.3(CE), for that I've gone through the below link. https://www.emiprotechnologies.com/technical_notes/magento-technical-notes-60/post/magento2-install-and-configure-varnish-cache-with-https-in-ubuntu-641 So based on this, I have done everything in my localhost. Moreover, I am not using any HTTPS & SSL...
Any other caching than var/cache? / Flush Magento Cache works, rm -rf var/cache not
We did an update on production but still a translation which was newly defined in a translate.csv file did not work. After rm -rf var/cache it still was not shown. We verified that the folder is empty. /tmp/magento also did not exist. After refreshing the page var/cache got filled again - so it is in fact used. We were able to make it work by Flush...
Built-in Cache vs. Varnish Cache for Full Page Cache - Magento2
What is the difference between the Built-in Cache and Varnish Cache for Full Page Cache? What options do I have to choose? Why does Magento recommend Varnish?
Understanding code and pratical
I have been reading a lot of blog from Alan strom and Magento tutorials and i have gained a lot, still blurry but good. Now i am at a point, where i need to put everything together. I am really lost on what and where to start but as for my understanding You call a controller and that controller in turn call a Action, which runs the code. The models...
Need help understanding Magento product collection objects and the catalog/product model
I've inherited a Magento project which an old developer was in charge of. Having very limited Magento experience, I'd like to understand how product collections and the catalog/product model is working. Specifically I'm wondering why the collection and product objects are so huge? I have code like this: When I do print_r($_productCollection) or pri...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.