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

This commit is contained in:
cyberpwn
2021-09-13 09:31:56 -04:00
parent ca961e8498
commit eeab12ed86
18 changed files with 25 additions and 64 deletions

View File

@@ -167,11 +167,7 @@ public class IrisEngineMantle implements EngineMantle {
for (String i : objects) {
e.queue(() -> {
try {
BlockVector bv = sizeCache.compute(i, (k, v) -> {
if (v != null) {
return v;
}
BlockVector bv = sizeCache.computeIfAbsent(i, (k) -> {
try {
return IrisObject.sampleSize(getData().getObjectLoader().findFile(i));
} catch (IOException ex) {
@@ -207,11 +203,7 @@ public class IrisEngineMantle implements EngineMantle {
for (String j : entry.getValue()) {
e.queue(() -> {
try {
BlockVector bv = sizeCache.compute(j, (k, v) -> {
if (v != null) {
return v;
}
BlockVector bv = sizeCache.computeIfAbsent(j, (k) -> {
try {
return IrisObject.sampleSize(getData().getObjectLoader().findFile(j));
} catch (IOException ioException) {