-
Notifications
You must be signed in to change notification settings - Fork 160
Severe performance regression in JavaPackage
#1098
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
Comments
Just to clarify: is it the call to |
#We faced same issue after upgraded to 1.3.3
modules.verify() test passed but writeModulesAsPlantUml runs endlessly. |
That would be a significantly different starting point for the analysis. The only thing we changed in the documentation generation is removing the dependency to Commons Logging that Structurizr pulled in (GH-1069). Would you mind trying to add it back (basically logically revert what we did in 8d3fcfb) and see whether that makes a difference? The only other thing that I could remotely think of affecting this is the change we made to the sub-package detection, but that should be triggered during the Could you run the problematic test case in debug mode, pause the JVM at some point while it's running unexpectedly long, and inspect the stack trace for Spring Modulith related stack frames? Alternatively, a reproducing project would be very nice, but I can see that it might be difficult to prepare one. The test cases don't reveal any obvious problems, and I've checked a couple of medium size projects that we usually use as smoke tests, but they all generate docs just fine. |
I can confirm, that the I manually added the |
This is a stack trace multiple minutes into the test. It takes 4s to complete using 1.3.2.
|
That's all incredibly helpful information, folks. I promise, we're not mining bitcoin on your machines! 😆 I strongly suspect |
For the record, 1cc5719 apparently took the sub-package detection out of the |
JavaPackage
The fix for GH-1039 introduced a performance regression as the calculation of the sub-packages escaped the SingletonSupplier and thus is now included in every hashCode() calculation. Took the chance to significantly revamp the sub-package calculation for nested packages. In other words, the entire sub-package arrangement for a package is calculated once with pre-computed intermediaries held instead of re-computing them per sub-package.
This has been fixed and back-ported to |
Finished in under 4s. Great work, thank you! |
Just out of curiosity: are you free to share how many packages this projects consists of? |
23 top level packages and 136 in total. Tbh we are still struggling to grasp the idea of internal and external packages. We have very few internal packages which has been a point of discussion in our team forever. |
Hm, I just tried a dummy project (26 packages with 26 nested packages each, containing a single type in turn) and I stay within under half a second for the PlantUML diagram creation. So I suspect that there are other factors (a larger number of package / module dependencies) contributing to the diagram creation time. |
We now resort to a simple iteration over the types within a Classes arrangement to detect all classes residing in certain packages. This is primarily used during the JavaPackage data structure construction as it's called for every sub-package of a package originally created from a Classes instance. The new simplified algorithm avoids set up of DescribedPredicate instances to eventually only perform simple package name checks.
We now resort to a simple iteration over the types within a Classes arrangement to detect all classes residing in certain packages. This is primarily used during the JavaPackage data structure construction as it's called for every sub-package of a package originally created from a Classes instance. The new simplified algorithm avoids set up of DescribedPredicate instances to eventually only perform simple package name checks.
We now resort to a simple iteration over the types within a Classes arrangement to detect all classes residing in certain packages. This is primarily used during the JavaPackage data structure construction as it's called for every sub-package of a package originally created from a Classes instance. The new simplified algorithm avoids set up of DescribedPredicate instances to eventually only perform simple package name checks.
We now resort to a simple iteration over the types within a Classes arrangement to detect all classes residing in certain packages. This is primarily used during the JavaPackage data structure construction as it's called for every sub-package of a package originally created from a Classes instance. The new simplified algorithm avoids set up of DescribedPredicate instances to eventually only perform simple package name checks.
Uh oh!
There was an error while loading. Please reload this page.
We use the verify and documentation test. In version 1.3.2 it takes around 15s and passes without problems. When upgrading to version 1.3.3, the test never finishes (>5min). Nothing else changed.
Our test:
The text was updated successfully, but these errors were encountered: