Open bseiller opened 6 years ago
Hi there,
Thanks for using this tool and raising awareness! Yes, a PR would help me a lot, either for merging it directly or as a starting point.
Ok - we are nearing a release, so time is a little short, but i'll try to do a PR with our modifications next week.
We are using jaxrs-analyzer-maven-plugin/jaxrs-analyzer to generate swagger for our service endpoints. The generation process got exponentially slower with every service class we added to the scanned packages. When it got unbearable we investigated and found the culprit in the class
com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.simulation.MethodPool
There the LinkedList availableMethods is being used as 'cache' which scanned/iterated completely for everyget(MethodIdentifier)
in the worst case => O(n). AlsoaddProjectMethod
does not check if a method is already in the list, which results in duplicate entries. This resulted in a runtime of ~ 160s with 28512 entries.Making availableMethods a Map/HashMap resulted in a runtime of ~ 14s with now only 7769 entries. => both faster and smaller memorywise
To make using a HashMap possible we introduced a method
MethodIdentifier getIdentifier()
in the interfacecom.sebastian_daschner.jaxrs_analyzer.model.methods.IdentifiableMethod
and implemented it for all classes implementing IdentifiableMethod.The resulting swagger.json was almost the same but for one minor difference; On of the scanned services returns a object with a member
private Map<Integer, List<Message>> messages
With the original code this was translated towhich is close, but still... in the changed code it became
really can't explain is the reason for this is...
If you are interested I could create a pull request, but since it changes your design I wanted to run it by you.
Cheers & thanks for this very nice tool!