Fixed
Details
Assignee
Yoann RodièreYoann RodièreReporter
Yoann RodièreYoann RodièreComponents
Sprint
NoneFix versions
Priority
Major
Details
Details
Assignee
Yoann Rodière
Yoann RodièreReporter
Yoann Rodière
Yoann RodièreComponents
Sprint
None
Fix versions
Priority
Created January 18, 2021 at 2:58 PM
Updated September 10, 2021 at 7:24 AM
Resolved January 22, 2021 at 2:17 PM
We could reduce allocations when entities are marked as updated in an indexing plan by switching to a different implementation of
PojoPathFilter
: instead of checking whether a path is in a set inside the indexing processor/reindexing resolver, we could assign an ordinal to each relevant property, and when an entity is updated we would set bits in aBitSet
for all properties that are matched. Then we would pass thatBitSet
to the indexing processor/reindexing resolver instead of theSet<String
.To compare, for each updated entity:
with the current approach, we would have one call to
HashSet.contains()
per filter and per path accepted by the filter. We would also have (roughly) one HashMap allocation and one HashMap entry allocation per relevant dirty path.with the proposed approach, we would have one call to
HashMap.get
per dirty path (relevant or not), then one call toBitSet.set
per dirty path, then one call toBitSet.intersects
per filter. We would also have exactly oneBitSet
allocation.As to how we would assign an ordinal to each property, Hibernate ORM already does, and we currently convert these ordinals to strings! See
org.hibernate.search.mapper.orm.event.impl.HibernateSearchEventListener#getDirtyPropertyNames
.The only problem would be collection roles (see call to
addOrUpdate
inorg.hibernate.search.mapper.orm.event.impl.HibernateSearchEventListener#processCollectionEvent
). We may be able to fall back to aMap<String, Integer>
for those?