mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Initial commit for FilePerMap implementation.
This commit is contained in:
@@ -119,4 +119,32 @@ public class FilePerMapKeyTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void perfTest(){
|
||||
//There are no entries in the map so null should be returned
|
||||
FilePerKeyMap<String, String> map = new FilePerKeyMap<>("/tmp/filepermaptests");
|
||||
|
||||
//just in case it hasn't been cleared up last time
|
||||
map.clear();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 2_000_000; i++) {
|
||||
sb.append('x');
|
||||
}
|
||||
String value = sb.toString();
|
||||
|
||||
//warmup
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
map.put("big file", value);
|
||||
}
|
||||
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
int iterations = 50;
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
map.put("big file", value);
|
||||
}
|
||||
System.out.println("Time to update "+ iterations + " iterations " + (System.currentTimeMillis()-time));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user