Only compute if absent/present if compute is not needed (locking opts)

This commit is contained in:
cyberpwn committed 2021-09-13 09:31:56 -04:00
1 parent ca961e8498
commit eeab12ed86
18 files changed
+25 -64

No files matched your search

@@ -329,12 +329,6 @@ public class PlannedStructure {
public IrisObject rotated(IrisJigsawPiece piece, IrisObjectRotation rotation) {
String key = piece.getObject() + "-" + rotation.hashCode();
return objectRotationCache.compute(key, (k, v) -> {
if (v == null) {
return rotation.rotateCopy(data.getObjectLoader().load(piece.getObject()));
}
return v;
});
return objectRotationCache.computeIfAbsent(key, (k) -> rotation.rotateCopy(data.getObjectLoader().load(piece.getObject())));
}
}