HHH-15325 Avoid allocations from BitSet.stream() in AbstractEntityPersister

This commit is contained in:
Christoph Dreis 2022-06-10 20:30:14 +02:00 committed by Christian Beikov
parent 4d070f24f9
commit 6a227b5ee2
1 changed files with 2 additions and 2 deletions

View File

@ -2542,7 +2542,7 @@ public abstract class AbstractEntityPersister
// We have to check the state for "mutable" properties as dirty tracking isn't aware of mutable types // We have to check the state for "mutable" properties as dirty tracking isn't aware of mutable types
final Type[] propertyTypes = entityMetamodel.getPropertyTypes(); final Type[] propertyTypes = entityMetamodel.getPropertyTypes();
final boolean[] propertyCheckability = entityMetamodel.getPropertyCheckability(); final boolean[] propertyCheckability = entityMetamodel.getPropertyCheckability();
mutablePropertiesIndexes.stream().forEach( i -> { for ( int i = mutablePropertiesIndexes.nextSetBit(0); i >= 0; i = mutablePropertiesIndexes.nextSetBit(i + 1) ) {
// This is kindly borrowed from org.hibernate.type.TypeHelper.findDirty // This is kindly borrowed from org.hibernate.type.TypeHelper.findDirty
final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY &&
// Consider mutable properties as dirty if we don't have a previous state // Consider mutable properties as dirty if we don't have a previous state
@ -2557,7 +2557,7 @@ public abstract class AbstractEntityPersister
if ( dirty ) { if ( dirty ) {
fields.add( i ); fields.add( i );
} }
} ); }
} }
if ( attributeNames.length != 0 ) { if ( attributeNames.length != 0 ) {