Giter Club home page Giter Club logo

Comments (8)

mnapoli avatar mnapoli commented on August 23, 2024 1

The thing is it's a very minor problem (I'm not sure it's a problem at all), and I don't see how to progress and I don't even really need a solution so I'd rather not take up your time that could be better spent ;)

from consistency.

Hywan avatar Hywan commented on August 23, 2024

Hello :-),

I am afraid you cannot. Hoa has a default autoloader and we need it. This is not intrusive though and you should not have any conflicts with Composer. Why do you want to remove it?

from consistency.

mnapoli avatar mnapoli commented on August 23, 2024

To be honest with you it appeared in Blackfire profilings, but then I realized that I was profiling with Composer dump -o and in the prod environment but with debug enabled (Symfony)… :p So after disabling debug it doesn't look like a problem anymore.

However the time spent in the Consistency class could still be avoided in dev/tests if there was a way to disable it, but it's less critical than if it was in production.

I can't share the whole profile but here is a screenshot of the autoloading part (when debug was enabled):

capture d ecran 2016-08-10 a 15 42 33

And if I search for Consistency:

capture d ecran 2016-08-10 a 15 42 51

In total there is maybe around 10ms spent in this Hoa class. As I said it's not a big issue, but it's still too bad.

from consistency.

Hywan avatar Hywan commented on August 23, 2024

I reckon the time spent might be because of the autoloading. So depending where your autoloading is positioned in the autoloader stack, Hoa\Consistency\Autoloader might receive a lot of requests, just like the one from Composer.

And this suggestion seems to be confirmed according to your profile. Hoa\Consistency\Autoloader is called 348x, which is the same for …\Debug\DebugClassLoader. So it doubly confirmes that this “issue” is strictly related to your debugging environment.

Yes, this is sad to not being able to disable Hoa's autoloader but it is required. Hoa is not always used or deployed in conjunction with Composer, so it must embed its own PSR-4 autoloader. However, it also requires to be enabled because of flexible entities, which is a mechanism ensuring forward and backward compatibility inside Hoa's libraries. This is a thin mechanism with a low memory footprint, … except in some edge cases like yours.

What you could do is to remove Hoa's autoloader and then re-add but after …\Debug\DebugClassLoader. Try this:

foreach (spl_autoload_functions() as $autoloader) {
    if (is_array($autoloader) && $autoloader[0] instanceof Hoa\Consistency\Autoloader) {
        $autoloader[0]->unregister();
        $autoloader[0]->register();
    }
}

If you know any mechanism to load Hoa after all your Composer dependencies, that would be better too.

Did I answer your question?

from consistency.

mnapoli avatar mnapoli commented on August 23, 2024

Thanks for the answer

from consistency.

Hywan avatar Hywan commented on August 23, 2024

Are you satisfied with this answer? If no, how could we progress?

from consistency.

Hywan avatar Hywan commented on August 23, 2024

@mnapoli Simple curiosity: What is the project you're using?

from consistency.

mnapoli avatar mnapoli commented on August 23, 2024

We are using Rulerz at Wizaplace (for pricing promotion rules)

from consistency.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.