Skip to content

Commit

Permalink
Disable statistics for TCache in JMH benchmarks (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Sep 22, 2017
1 parent ac00474 commit 61008d9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public enum CacheType {
},
LinkedHashMap_Lru {
@Override public <K, V> BasicCache<K, V> create(int maximumSize) {
return new LinkedHashMapCache<>(true, maximumSize);
return new LinkedHashMapCache<>(maximumSize, /* accessOrder */ true);
}
},
Rapidoid {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
public final class LinkedHashMapCache<K, V> implements BasicCache<K, V> {
private final Map<K, V> map;

public LinkedHashMapCache(boolean accessOrder, int maximumSize) {
map = new BoundedLinkedHashMap<>(accessOrder, maximumSize);
public LinkedHashMapCache(int maximumSize, boolean accessOrder) {
map = new BoundedLinkedHashMap<>(maximumSize, accessOrder);
}

@Override
Expand Down Expand Up @@ -58,7 +58,7 @@ static final class BoundedLinkedHashMap<K, V> extends LinkedHashMap<K, V> {
private static final long serialVersionUID = 1L;
private final int maximumSize;

public BoundedLinkedHashMap(boolean accessOrder, int maximumSize) {
public BoundedLinkedHashMap(int maximumSize, boolean accessOrder) {
super(maximumSize, 0.75f, accessOrder);
this.maximumSize = maximumSize;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*/
package com.github.benmanes.caffeine.cache.impl;

import static com.github.benmanes.caffeine.cache.CacheType.CONCURRENCY_LEVEL;

import com.github.benmanes.caffeine.cache.BasicCache;
import com.github.benmanes.caffeine.cache.CacheType;
import com.trivago.triava.tcache.Cache;
import com.trivago.triava.tcache.EvictionPolicy;
import com.trivago.triava.tcache.TCacheFactory;
Expand All @@ -29,9 +30,10 @@ public final class TCache<K, V> implements BasicCache<K, V> {

public TCache(int maximumSize, EvictionPolicy policy) {
cache = TCacheFactory.standardFactory().<K, V>builder()
.setConcurrencyLevel(CacheType.CONCURRENCY_LEVEL)
.setConcurrencyLevel(CONCURRENCY_LEVEL)
.setMaxElements(maximumSize)
.setEvictionPolicy(policy)
.setStatistics(false)
.build();
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ext {
expiringMap: '0.5.8',
jackrabbit: '1.7.7',
jamm: '0.3.2',
javaObjectLayout: '0.8',
javaObjectLayout: '0.9',
jmh: 1.19,
koloboke: '0.6.8',
ohc: '0.6.1',
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-rc-2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-bin.zip

0 comments on commit 61008d9

Please sign in to comment.