GitHub user rovarga opened a pull request:
https://github.com/apache/karaf/pull/336
Optimize GenerateDescriptorMojo
OpenDaylight typically processes deeply nested feature.xmls, which takes
significant time. This PR optimizes GenerateDescriptorMojo, reducing build time
observed by a factor of 3.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/rovarga/karaf generate-features
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/karaf/pull/336.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #336
----
commit 689b415c45a1f5ac21b29a08fd65408018c0772f
Author: Robert Varga <[email protected]>
Date: 2017-08-13T16:56:29Z
Use java.util.file.Files.newInputStream()
Instead of wiring to FileInputStream, which is hard to GC due to
the presence of finalize(), use Files.newInputStream.
Brings down feature generation time in OpenDaylight, before:
real 2m5.828s
user 2m14.886s
sys 0m20.849s
after:
real 1m46.523s
user 1m59.258s
sys 0m17.048s
Signed-off-by: Robert Varga <[email protected]>
commit d429f8030235e5cfd1fd20130e231acf000b327b
Author: Robert Varga <[email protected]>
Date: 2017-08-13T17:38:26Z
Cache unmarshalled Features
If we are processing a deep feature tree with multiple dependencies
referencing same features (like in the case of OpenDaylight), we end
up unmarshalling the same features over and over again.
Rather than doing that, instantiate a cache, which will hold a weak
reference to features already encountered.
Before:
real 1m46.523s
user 1m59.258s
sys 0m17.048s
After:
real 0m42.642s
user 1m0.892s
sys 0m10.148s
Signed-off-by: Robert Varga <[email protected]>
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---