From a69ffc8b0ad9e1d4df35f221d53fdedfce16f347 Mon Sep 17 00:00:00 2001 From: Christoph Dreis Date: Wed, 15 Jun 2022 10:03:58 +0200 Subject: [PATCH] HHH-15325 Avoid allocations from BitSet.stream() in AbstractEntityPersister --- .../hibernate/persister/entity/AbstractEntityPersister.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index e313235327..31bc2dc4dc 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -2287,7 +2287,7 @@ public abstract class AbstractEntityPersister // We have to check the state for "mutable" properties as dirty tracking isn't aware of mutable types final Type[] propertyTypes = entityMetamodel.getPropertyTypes(); 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 final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && // Consider mutable properties as dirty if we don't have a previous state @@ -2302,7 +2302,7 @@ public abstract class AbstractEntityPersister if ( dirty ) { fields.add( i ); } - } ); + } } if ( attributeNames != null ) {