fName = name;
}
+ /**
+ * Get the number of segments to add to the segment store
+ *
+ * @return The number of segments to add to the segment store
+ */
+ protected long getSegmentStoreSize() {
+ return 1000000;
+ }
+
/**
* Add elements in order
*/
outputResults(duration, method);
}
- private static long populate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store) {
+
+ private long populate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store) {
store.clear();
long start = System.nanoTime();
- populate(size, fuzz, store, 1000000);
+ populate(size, fuzz, store, getSegmentStoreSize());
long end = System.nanoTime();
return end - start;
}
outputResults(duration, method);
}
- private static long addAndIterate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store) {
+ private long addAndIterate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store) {
long start = System.nanoTime();
populate(size, fuzz, store);
iterate(store);
return shutupCompilerWarnings;
}
- private static void populate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store, int count) {
+ private static void populate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store, long count) {
for (int i = 0; i < count; i++) {
- long start = i + fuzz[i % size];
+ long start = (long) i + fuzz[i % size];
store.add(new BasicSegment(start, start + 10));
}
}