Skip to content

Commit

Permalink
Fix perf slowdown caused by AnyHolderSet#contains (#1775)
Browse files Browse the repository at this point in the history
Co-authored-by: Brennan Ward <[email protected]>
  • Loading branch information
embeddedt and Shadows-of-Fire authored Dec 15, 2024
1 parent 32a1087 commit f7a5bc8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public Holder<T> get(int i) {

@Override
public boolean contains(Holder<T> holder) {
return holder.unwrapKey().map(key -> this.registryLookup.listElementIds().anyMatch(key::equals)).orElse(false);
ResourceKey<T> key = holder.getKey();
return key != null && this.registryLookup().get(key).isPresent();
}

@Override
Expand Down

0 comments on commit f7a5bc8

Please sign in to comment.