Skip to content

Commit 6777977

Browse files
stuartwdouglasSanne
authored andcommitted
HHH-10301 Don't allocate a new List if it is not required
1 parent a4b74e2 commit 6777977

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hibernate-core/src/main/java/org/hibernate/engine/query/spi/HQLQueryPlan.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ public List performList(
211211
queryParametersToUse = queryParameters;
212212
}
213213

214+
//fast path to avoid unnecessary allocation and copying
215+
if ( translators.length == 1 ) {
216+
return translators[0].list( session, queryParametersToUse );
217+
}
214218
final int guessedResultSize = guessResultSize( rowSelection );
215219
final List combinedResults = new ArrayList( guessedResultSize );
216220
final IdentitySet distinction;

0 commit comments

Comments
 (0)