mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-231 Add another test to show it works.
This commit is contained in:
@@ -553,8 +553,10 @@ public final class ChronicleMapBuilder<K, V> implements Cloneable,
|
||||
|
||||
private int estimateSegmentsBasedOnSize() {
|
||||
// based on entries with multimap of 100 bytes.
|
||||
int segmentsForEntries = estimateSegmentsForEntries();
|
||||
return entrySize >= 100000
|
||||
int segmentsForEntries = estimateSegmentsForEntries(entries);
|
||||
return entrySize >= 1000000
|
||||
? segmentsForEntries * 16
|
||||
: entrySize >= 100000
|
||||
? segmentsForEntries * 8
|
||||
: entrySize >= 10000
|
||||
? segmentsForEntries * 4
|
||||
@@ -563,8 +565,7 @@ public final class ChronicleMapBuilder<K, V> implements Cloneable,
|
||||
: segmentsForEntries;
|
||||
}
|
||||
|
||||
private int estimateSegmentsForEntries() {
|
||||
long size = entries;
|
||||
private static int estimateSegmentsForEntries(long size) {
|
||||
if (size > 200 << 20)
|
||||
return 256;
|
||||
if (size >= 1 << 20)
|
||||
@@ -575,6 +576,8 @@ public final class ChronicleMapBuilder<K, V> implements Cloneable,
|
||||
return 32;
|
||||
if (size >= 4 << 10)
|
||||
return 16;
|
||||
if (size >= 1 << 10)
|
||||
return 8;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,24 +103,25 @@ public class LargeEntriesTest {
|
||||
@Ignore("Performance Test")
|
||||
public void testLargeStringsPerf() throws ExecutionException, InterruptedException, IOException {
|
||||
doLargeEntryPerf(10000, 100 * 1024);
|
||||
doLargeEntryPerf(1000000, 1024);
|
||||
doLargeEntryPerf(100000, 10 * 1024);
|
||||
doLargeEntryPerf(10000, 100 * 1024);
|
||||
doLargeEntryPerf(3000, 1024 * 1024);
|
||||
}
|
||||
|
||||
private void doLargeEntryPerf(int ENTRIES, final int ENTRY_SIZE) throws IOException, InterruptedException, ExecutionException {
|
||||
System.out.printf("Testing %,d entries of %,d KB%n", ENTRIES, ENTRY_SIZE);
|
||||
System.out.printf("Testing %,d entries of %,d KB%n", ENTRIES, ENTRY_SIZE / 1024);
|
||||
File file = File.createTempFile("largeEntries", ".deleteme");
|
||||
file.deleteOnExit();
|
||||
final ChronicleMap<String, String> map = ChronicleMapBuilder
|
||||
.of(String.class, String.class)
|
||||
.valueMarshaller(SnappyStringMarshaller.INSTANCE)
|
||||
.entries(ENTRIES * 2)
|
||||
.entrySize(ENTRY_SIZE / 6)
|
||||
.entries(ENTRIES)
|
||||
.entrySize(ENTRY_SIZE / 7 + 200)
|
||||
.putReturnsNull(true)
|
||||
.createPersistedTo(file);
|
||||
{
|
||||
warmUpCompression(ENTRY_SIZE);
|
||||
// warmUpCompression(ENTRY_SIZE);
|
||||
int threads = Runtime.getRuntime().availableProcessors();
|
||||
ExecutorService es = Executors.newFixedThreadPool(threads);
|
||||
final int block = ENTRIES / threads;
|
||||
|
||||
Reference in New Issue
Block a user