use of de.invesdwin.util.time.Instant in project invesdwin-context-persistence by subes.
the class CqenginePerformanceTest method readGet.
private void readGet(final IndexedCollection<Content> table) throws InterruptedException {
final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck(Duration.ONE_SECOND);
final List<FDate> values = Lists.toList(newValues());
final Instant readsStart = new Instant();
for (int reads = 0; reads < READS; reads++) {
FDate prevValue = null;
int count = 0;
for (int i = 0; i < values.size(); i++) {
try (ResultSet<Content> result = table.retrieve(QueryFactory.equal(Content.KEY, values.get(i).millisValue()))) {
final FDate value = result.uniqueResult().getValue();
if (prevValue != null) {
Assertions.checkTrue(prevValue.isBefore(value));
}
prevValue = value;
count++;
}
}
Assertions.checkEquals(count, VALUES);
if (loopCheck.check()) {
printProgress("Gets", readsStart, VALUES * reads, VALUES * READS);
}
}
printProgress("GetsFinished", readsStart, VALUES * READS, VALUES * READS);
}
use of de.invesdwin.util.time.Instant in project invesdwin-context-persistence by subes.
the class LsmTreePerformanceTest method readGet.
private void readGet(final Store<FDate, FDate> table) throws InterruptedException, IOException {
final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck(Duration.ONE_SECOND);
final List<FDate> values = Lists.toList(newValues());
final Instant readsStart = new Instant();
for (int reads = 1; reads <= READS; reads++) {
FDate prevValue = null;
for (int i = 0; i < values.size(); i++) {
try {
final FDate value = table.get(values.get(i));
if (prevValue != null) {
Assertions.checkTrue(prevValue.isBefore(value));
}
prevValue = value;
} catch (final NoSuchElementException e) {
break;
}
}
if (loopCheck.check()) {
printProgress("Gets", readsStart, VALUES * reads, VALUES * READS);
}
}
printProgress("GetsFinished", readsStart, VALUES * READS, VALUES * READS);
}
use of de.invesdwin.util.time.Instant in project invesdwin-context-persistence by subes.
the class DuckDBPerformanceTest method readIterator.
private void readIterator(final Connection conn) throws Exception {
final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck(Duration.ONE_SECOND);
final Instant readsStart = new Instant();
final Statement select = conn.createStatement();
for (int reads = 1; reads <= READS; reads++) {
FDate prevValue = null;
int count = 0;
try (ResultSet results = select.executeQuery("SELECT value FROM abc ORDER BY KEY ASC")) {
while (results.next()) {
final FDate value = new FDate(results.getLong(1));
if (prevValue != null) {
Assertions.checkTrue(prevValue.isBefore(value));
}
prevValue = value;
count++;
}
}
Assertions.checkEquals(count, VALUES);
if (loopCheck.check()) {
printProgress("Reads", readsStart, VALUES * reads, VALUES * READS);
}
}
printProgress("ReadsFinished", readsStart, VALUES * READS, VALUES * READS);
}
use of de.invesdwin.util.time.Instant in project invesdwin-context-persistence by subes.
the class DuckDBPerformanceTest method readGet.
private void readGet(final Connection conn) throws Exception {
final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck(Duration.ONE_SECOND);
final List<FDate> values = Lists.toList(newValues());
final Instant readsStart = new Instant();
for (int reads = 0; reads < READS; reads++) {
FDate prevValue = null;
int count = 0;
try (Statement select = conn.createStatement()) {
for (int i = 0; i < values.size(); i++) {
try (ResultSet results = select.executeQuery("SELECT value FROM abc where key = " + values.get(i).millisValue() + " LIMIT 1")) {
Assertions.checkTrue(results.next());
final FDate value = new FDate(results.getLong(1));
if (prevValue != null) {
Assertions.checkTrue(prevValue.isBefore(value));
}
prevValue = value;
count++;
if (loopCheck.check()) {
printProgress("Gets", readsStart, VALUES * reads + count, VALUES * READS);
}
}
}
}
Assertions.checkEquals(count, VALUES);
}
printProgress("GetsFinished", readsStart, VALUES * READS, VALUES * READS);
}
use of de.invesdwin.util.time.Instant in project invesdwin-context-persistence by subes.
the class DuckDBPerformanceTest method readGetLatest.
private void readGetLatest(final Connection conn) throws Exception {
final LoopInterruptedCheck loopCheck = new LoopInterruptedCheck(Duration.ONE_SECOND);
final List<FDate> values = Lists.toList(newValues());
final Instant readsStart = new Instant();
for (int reads = 0; reads < READS; reads++) {
FDate prevValue = null;
int count = 0;
try (Statement select = conn.createStatement()) {
for (int i = 0; i < values.size(); i++) {
try (ResultSet results = select.executeQuery("SELECT max(value) FROM abc WHERE key <= " + values.get(i).millisValue() + " LIMIT 1")) {
Assertions.checkTrue(results.next());
final FDate value = new FDate(results.getLong(1));
if (prevValue != null) {
Assertions.checkTrue(prevValue.isBefore(value));
}
prevValue = value;
count++;
if (loopCheck.check()) {
printProgress("GetLatests", readsStart, VALUES * reads + count, VALUES * READS);
}
}
}
}
Assertions.checkEquals(count, VALUES);
}
printProgress("GetLatestsFinished", readsStart, VALUES * READS, VALUES * READS);
}
Aggregations