Micro optimisations of StandardRowReader

This commit is contained in:
Sanne Grinovero 2024-02-05 16:08:36 +00:00 committed by Christian Beikov
parent c958b429f2
commit d613c69863
1 changed files with 10 additions and 3 deletions

View File

@ -22,6 +22,8 @@ import org.hibernate.sql.results.spi.RowReader;
import org.hibernate.sql.results.spi.RowTransformer;
import org.hibernate.type.descriptor.java.JavaType;
import org.jboss.logging.Logger;
/**
* @author Steve Ebersole
*/
@ -34,6 +36,8 @@ public class StandardRowReader<T> implements RowReader<T> {
private final int assemblerCount;
private static final Logger LOGGER = LoadingLogger.LOGGER;
public StandardRowReader(
List<DomainResultAssembler<?>> resultAssemblers,
InitializersList initializers,
@ -82,14 +86,17 @@ public class StandardRowReader<T> implements RowReader<T> {
@Override
public T readRow(RowProcessingState rowProcessingState, JdbcValuesSourceProcessingOptions options) {
LoadingLogger.LOGGER.trace( "StandardRowReader#readRow" );
LOGGER.trace( "StandardRowReader#readRow" );
coordinateInitializers( rowProcessingState );
final Object[] resultRow = new Object[ assemblerCount ];
final boolean debugEnabled = LOGGER.isDebugEnabled();
for ( int i = 0; i < assemblerCount; i++ ) {
final DomainResultAssembler assembler = resultAssemblers.get( i );
LoadingLogger.LOGGER.debugf( "Calling top-level assembler (%s / %s) : %s", i, assemblerCount, assembler );
if ( debugEnabled ) {
LOGGER.debugf( "Calling top-level assembler (%s / %s) : %s", i, assemblerCount, assembler );
}
resultRow[i] = assembler.assemble( rowProcessingState, options );
}
@ -99,7 +106,7 @@ public class StandardRowReader<T> implements RowReader<T> {
}
private void afterRow(RowProcessingState rowProcessingState) {
LoadingLogger.LOGGER.trace( "StandardRowReader#afterRow" );
LOGGER.trace( "StandardRowReader#afterRow" );
initializers.finishUpRow( rowProcessingState );
}