use of com.questdb.model.Band in project questdb by bluestreak01.
the class BinaryTest method testBinaryPerformance.
@Test
public void testBinaryPerformance() throws Exception {
try (JournalWriter<Band> writer = getFactory().writer(Band.class)) {
final int count = 20000;
Rnd r = new Rnd(System.currentTimeMillis(), System.currentTimeMillis());
byte[] bytes = r.nextBytes(10240);
String[] types = new String[] { "jazz", "rap", "pop", "rock", "soul" };
String[] bands = new String[1200];
for (int i = 0; i < bands.length; i++) {
bands[i] = r.nextString(10);
}
long t = System.nanoTime();
Band band = new Band();
for (int i = 0; i < count; i++) {
band.setName(bands[Math.abs(r.nextInt() % bands.length)]);
band.setType(types[Math.abs(r.nextInt() % types.length)]);
band.setImage(bytes);
writer.append(band);
}
writer.commit();
LOGGER.info().$("Appended ").$(count).$(" 10k blobs in ").$(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t)).$("ms.").$();
}
}
Aggregations