9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-28 11:39:07 +00:00

Stop tracking cache hit ratios

This commit is contained in:
Daniel Mills
2021-07-17 00:29:47 -04:00
parent da1895125a
commit 92f5783f35
2 changed files with 1 additions and 23 deletions

View File

@@ -29,9 +29,6 @@ import java.util.concurrent.atomic.AtomicInteger;
public class CachedStream2D<T> extends BasicStream<T> implements ProceduralStream<T> {
private final ProceduralStream<T> stream;
private final ConcurrentLinkedHashMap<Long, T> cache;
public static final AtomicInteger cacheHits = new AtomicInteger();
public static final AtomicInteger cacheMisses = new AtomicInteger();
public static final AtomicInteger evictions = new AtomicInteger();
public CachedStream2D(ProceduralStream<T> stream, int size) {
super();
@@ -40,7 +37,6 @@ public class CachedStream2D<T> extends BasicStream<T> implements ProceduralStrea
.initialCapacity(size)
.maximumWeightedCapacity(size)
.concurrencyLevel(32)
.listener((k, v) -> evictions.incrementAndGet())
.build();
}
@@ -61,16 +57,7 @@ public class CachedStream2D<T> extends BasicStream<T> implements ProceduralStrea
return stream.get((int) x, (int) z);
}
return cache.compute(Cache.key((int) x, (int) z), (k, v) -> {
if(v != null )
{
cacheHits.incrementAndGet();
return v;
}
cacheMisses.incrementAndGet();
return stream.get((int) x, (int) z);
});
return cache.compute(Cache.key((int) x, (int) z), (k, v) -> v != null ? v : stream.get((int) x, (int) z));
}
@Override