• Resolved David Bee

    (@davidbawiec)


    Hi! Back again, this time with a request/suggestion. ?? I’m curious what your thought process was behind disabling opcache during the test in the mu-plugin and also using opcache_reset(); in ajax.php? I can see use cases where users may want to see the absolute raw data, however, having some sort of code caching system in place is quite common to help speed up code execusion. It would be great if you could maybe either add a filter or a checkbox in the settings allowing users to skip disabling/resetting the cache. That way we can see how the site performs with opcache enabled and where there are still bottlenecks. Thoughts?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author bruandet

    (@bruandet)

    It’s not possible unfortunately. There are a few reasons:
    1. The profiler needs to hooks all file I/O in order to inject its code into the PHP compiler. But if you want to deal directly with the opcode cache, there’s no more file I/O and no more compiler. The profiler won’t even load or run.
    2. Since version 7.0, PHP includes an opcode optimizer: after creating the first set of opcodes, it forwards it to the optimizer where it will get through 13 passes that will optimize it (peephole, jump, call, literal optimizations etc). That means that at the end of the day, your code in the opcache may have been optimized and thus don’t match your original code found in your scripts. That problem occurs with xdebug too, which can’t run well when the optimizer is turned on because it removes some VM instructions xdebug needs. The optimizer is turned on by default and it’s one of the reasons why PHP is faster and uses less memory since v7.0.

    Thread Starter David Bee

    (@davidbawiec)

    You are 100% right. I tested soon after posting this and realized the error in my ways. ha. But thanks for the explainer. Learn something new every day! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Allow for a filter/toggle to not clear OPCache’ is closed to new replies.