HHH-10301 Don't allocate a new List if it is not required

This commit is contained in:
Stuart Douglas 2015-11-19 10:04:17 +11:00 committed by Sanne Grinovero
parent 2e8d52e654
commit f4e58d342d
1 changed files with 4 additions and 0 deletions

View File

@ -211,6 +211,10 @@ public class HQLQueryPlan implements Serializable {
queryParametersToUse = queryParameters;
}
//fast path to avoid unnecessary allocation and copying
if ( translators.length == 1 ) {
return translators[0].list( session, queryParametersToUse );
}
final int guessedResultSize = guessResultSize( rowSelection );
final List combinedResults = new ArrayList( guessedResultSize );
final IdentitySet distinction;