leangen / geantyref

Advanced generic type reflection library with support for working with AnnotatedTypes (for Java 8+)
Apache License 2.0
99 stars 15 forks source link

GenericTypeReflector: improve efficiency by reducing Streams usage #19

Closed stevenschlansker closed 1 year ago

stevenschlansker commented 1 year ago

Streams is a very flexible way to process data, but it involves a lot of classes and complexity.

For Arrays.stream, we are always doing the exact same fixed size array mapping, so we don't need all the features that comes with Streams, and can just use a simple helper method.

For GTR.merge, we repeatedly concat() streams and create lots of intermediate distinct operations and array objects.

We noticed this on a profiler in our app. It does not take a ton of time, but it seems like an easy improvement.

kaqqao commented 1 year ago

Hey, thanks for the contribution! Sorry for the slow response 🙈