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

@@ -892,7 +892,7 @@ public class IrisInterpolation {
int fj = j;
for (k = 0; k < d; k++) {
int fk = k;
hunk.set(i, j, k, cache.compute((k * w * h) + (j * w) + i, (p, v)
hunk.set(i, j, k, cache.computeIfAbsent((k * w * h) + (j * w) + i, (p)
-> getNoise3D(method, fi + xo, fj + yo, fk + zo,
radX, radY, radZ, n)));
}