Comments (8)
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.
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.
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):
And if I search for Consistency
:
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.
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.
Thanks for the answer
from consistency.
Are you satisfied with this answer? If no, how could we progress?
from consistency.
@mnapoli Simple curiosity: What is the project you're using?
from consistency.
We are using Rulerz at Wizaplace (for pricing promotion rules)
from consistency.
Related Issues (13)
- `void` is a new reserved keyword HOT 10
- `isIdentifier` has changed since PHP7.1 HOT 2
- Drop the `trait_exists` polyfill
- `Consistency::getPHPBinary` does not support HHVM HOT 2
- Usage of Consistency::flexEntity breaks static analysis HOT 7
- Add `hoa\devtools` to suggest package in composer.json HOT 6
- Dependabot can't resolve your PHP dependency files
- Dependabot can't resolve your PHP dependency files HOT 1
- Do not use flexEntity in Hoa itself HOT 2
- Problem with enabled opcache.preload HOT 1
- Dependabot can't resolve your PHP dependency files
- Dependabot can't resolve your PHP dependency files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from consistency.