Jump to content
pleini

FileCompiler - when is it compiling?

Recommended Posts

Hello Guys,

i have a question regarding the fileCompiler of PW 3.x. On my page i am monitoring the execution times and sometimes i have some peaks in the execution time. I profiled the code and i recognized that those peaks come from the fileCompiler, more specific from the function compileNamespace (preg_match_all takes the most time).

So my question is, how does the FileCompiler decides when it compiles the files, and would it be possible that i trigger the compilation of all files after a new deployment so that during requests of visitors of my page there are no compilations, to keep the loading times as low as possible?

 

thank you

Joscha

Share this post


Link to post
Share on other sites

The FileCompiler only compiles files if there has been a change to a file since it's last compilation. So once you deploy, if you don't change any template files. or update any modules, the file compiler doesn't do anything. If you then make a change, it will compile the one time (likely when you view your changes) and that is it, so the users will probably never have to wait for it to compile.

That said, the only time I ever notice the file compiler is during an upgrade of a site from 2.x to 3.x when it has to compile all template and module files at once. I have never noticed the time for compiling one file. If you are seeing peaks from the file compiler on every page load, maybe there is something amiss?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By modifiedcontent
      I had upgraded my Apache configuration to include PHP7.2 and PHP7.3 for a Laravel-based script on the same server. Somehow it/I messed up a previously fine Processwire site, in a very confusing way.
      The site still looks fine, but editing template files has no effect whatsoever. It is stuck on some kind of cached version. I have already disabled PHP7's OPcache, cleared browser caches, etc, with no effect.
      The pages now apparently come from PW's assets/cache/FileCompiler folder, even though I never enabled template caching for this site.
      I have tried adding "namespace ProcessWire;" to the top of the homepage template file, but then I get this fatal error:
      My functions.php file pulls data in from another Processwire installation on the same VPS with the following line:
      $othersitedata = new ProcessWire('/home/myaccount/public_html/myothersite/site/', 'https://myothersite.com/'); That apparently still works fine; the site still displays data from the other installation, but via the "cached" template that I am now unable to change.
       
      I don't know where to start with this mess. Does any of this sound familiar to anyone? Any pointers in the right direction would be much appreciated. 
       
      Edit:
      Adding "$config->templateCompile = false;" to config.php results in the same fatal error as above. 
    • By usualCommission
      I'm building a site that renders certain features using reusable classes. Unfortunately FileCompiler caches the files and my changes don't show up unless I clear the FileCompiler cache.
      On top of that, when I try to use the wire() function inside a class it throws a "Fatal error: Uncaught Error: Call to undefined function wire()". I've tried playing with ProcessWire namespacing, but have come up short.
      My files are structured as such:
      app.php - Is included in my templates and loads classes as they're called with spl_autoload_register.
      - classes/ExampleClass.class.php - Loaded by app.php
      Thanks!
       
    • By hellomoto
      There is no reason for this to have happened, I was not working on anything related to this:
      I deleted the site cache and it's still happening. The whole site is broken. This is what happened last time and I had to rebuild. Now I'll have to again. I really need to use version control this time for sure. But nonetheless, I wasn't even working on these files.
    • By pleini
      Hey,
      I have a question regarding the fileCompiler: is it possible to compile all files (templates + modules) with the filecompiler at once after a deploy (in a composerPostinstall for example) and disable it afterwards completely. The problem is, when i am deploying a new version to my instances, the cache folders might be replaced, so the files need to be recompiled when the first user is visiting the page after deployment. With that "pre-compilation" i want to prevent that the users have to wait for the filecompiler to compile.
      Thanks
      Chris
×
×
  • Create New...