-
Couldn't load subscription status.
- Fork 43
Reduce cpu usage for proxy creation #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Reduce cpu usage for proxy creation #687
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solution without introduction of the new dependency is preferred
afdd029 to
ceef811
Compare
|
Updated license agreement, made changes as requested |
Some tests implicitly require a specific line-ending or a locale to be set. Adjusting those to run the test-suites without changing the local dev-setup.
Cache JAXBContext to avoid frequent instantiations of it. The benefit of this caching depend on the use implementation of "jakarta.xml.bind.JAXBContextFactory", e.g. the glassfish-implementation is faster as some others, so the computation-time saved here is lower when using glassfish-impl compared to using a slower implementation.
Creating a MetroConfigLoader requires frequent class- and resource-loading, so re-use factories when applicable
Iterating over the ServiceLoader results in class- and resource-loading, which becomes expensive if done extensively.
A common pattern used (in e.g. "com.sun.xml.ws.api.pipe.TransportTubeFactory::create") is to search first for multiple factory-implementations before falling back to a "default" factory / implementation:
public Type exampleFunc(...) {
for (_ : ServiceFinder.find(FactoryType1.class) { return if FactoryType1-impl found }
for (_ : ServiceFinder.find(FactoryType2.class) { return if FactoryType2-impl found }
return DEFAULT_FACTORY.createType(..);
}
If there are no other implementations present besides the default-fallback-implementation, then each call to a method with this structure starts searching (again) for all non-default implementations - only to not find any implementing classes and finally falling back to the default-implementation.
Invoking such method-structures often, results in multiple unnecessary ServiceLoader-calls, because if the corresponding service-class and classloader are identical to a previous call and for this previous call the classloader was not able to determine the service-implementation, then it still won't be able to find it when retrying the ServiceLoader-call with the same parameters.
ceef811 to
981109e
Compare
|
Rebased onto latest master-branch. PR would be ready for review, @lukasj |
|
I am also affected by this performance problem. The patch shows significant performance improvements (factor 20) for my use case. Is there anything I can contribute to progress this? |
|
@lukasj What can be done to progress this? |
Related issue #686