Skip to content

Commit 4e7ab8e

Browse files
stalepwillr3
authored andcommitted
Skip Hibernate deep copy for ValueEntity.data JSON column
Add @mutability(Immutability.class) to the JSONB data field so Hibernate uses reference equality instead of deserialize-compare-reserialize for dirty checking. All code paths that modify data use reference replacement (data = newData), never in-place mutation, so reference equality is correct. Profiling showed deepCopy + dirty-checking of the JSON column consumed ~50% of CPU during uploads. This eliminates both entirely — deepCopy drops to 0 samples, dirty-checking to near-zero. Wall-clock improvement of ~17% on a 4-worker rhivos import (1m36s to 1m20s) with CPU user time cut in half (2m02s to 59s).
1 parent ce04c60 commit 4e7ab8e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/java/io/hyperfoil/tools/h5m/entity/ValueEntity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import jakarta.persistence.*;
1010
import org.hibernate.annotations.CreationTimestamp;
1111
import org.hibernate.annotations.JdbcTypeCode;
12+
import org.hibernate.annotations.Mutability;
1213
import org.hibernate.type.SqlTypes;
14+
import org.hibernate.type.descriptor.java.Immutability;
1315

1416
import java.time.LocalDateTime;
1517
import java.util.*;
@@ -25,6 +27,7 @@ public class ValueEntity extends PanacheEntity {
2527
@Column(columnDefinition = "JSONB")
2628
@JdbcTypeCode(SqlTypes.JSON)
2729
@Basic(fetch = FetchType.LAZY)
30+
@Mutability(Immutability.class)
2831
public JsonNode data;
2932

3033
//not yet used but the idea is to sort multiple values based on idx to preserve node output order for next nodes input

0 commit comments

Comments
 (0)