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

@@ -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)));
}