DATACMNS-1556 - General performance improvements in repository execution.

We now avoid the allocation of an Optional instance in the lookup of a dynamic projection in ParameterAccessor. Also, Lazy now exposes a ….getNullable() to be favored over ….getOptional() for hot code paths.

Replaced Stream and Optional usage with for-loops and nullable return values. Reuse parameter names to avoid repeated annotation lookups. Reuse result from Parameters.getBindable(). Introduce ParametersParameterAccessor.getValues() to consistently reuse a single accessor instance allowing access to the unwrapped values. Introduce type cache to QueryExecutionConverters to quickly reject types that do not require wrapping. Avoid recalculation of QueryMethod.isCollectionQuery().
This commit is contained in:
Mark Paluch
2019-07-19 15:26:42 +02:00
committed by Oliver Drotbohm
parent e0f2d65d73
commit 293bbd9a63
11 changed files with 143 additions and 58 deletions

View File

@@ -74,7 +74,7 @@ public class Lazy<T> implements Supplier<T> {
/**
* Creates a pre-resolved empty {@link Lazy}.
*
*
* @return
* @since 2.1
*/
@@ -103,7 +103,7 @@ public class Lazy<T> implements Supplier<T> {
/**
* Returns the {@link Optional} value created by the configured {@link Supplier}, allowing the absence of values in
* contrast to {@link #get()}. Will return the calculated instance for subsequent lookups.
*
*
* @return
*/
public Optional<T> getOptional() {
@@ -112,7 +112,7 @@ public class Lazy<T> implements Supplier<T> {
/**
* Returns a new Lazy that will consume the given supplier in case the current one does not yield in a result.
*
*
* @param supplier must not be {@literal null}.
* @return
*/
@@ -125,7 +125,7 @@ public class Lazy<T> implements Supplier<T> {
/**
* Returns a new Lazy that will return the given value in case the current one does not yield in a result.
*
*
* @param supplier must not be {@literal null}.
* @return
*/
@@ -198,9 +198,10 @@ public class Lazy<T> implements Supplier<T> {
* Returns the value of the lazy evaluation.
*
* @return
* @since 2.2
*/
@Nullable
private T getNullable() {
public T getNullable() {
T value = this.value;