@Override protected void doBatchCrudRun(int count) throws Exception { final List<SimpleEntityNotNull> list = new ArrayList<>(); for (int i = 0; i < count; i++) { list.add(SimpleEntityNotNullHelper.createEntity((long) i)); } startClock(); realm.beginTransaction(); realm.insert(list); realm.commitTransaction(); stopClock(Benchmark.Type.BATCH_CREATE); startClock(); realm.beginTransaction(); realm.insertOrUpdate(list); realm.commitTransaction(); stopClock(Benchmark.Type.BATCH_UPDATE); startClock(); RealmResults<SimpleEntityNotNull> reloaded = realm.where(SimpleEntityNotNull.class).findAll(); stopClock(Benchmark.Type.BATCH_READ); // as Realm is not actually loading data, just referencing it, // at least make sure we access every property to force it being loaded startClock(); for (int i = 0; i < reloaded.size(); i++) { SimpleEntityNotNull entity = reloaded.get(i); entity.getId(); entity.getSimpleBoolean(); entity.getSimpleByte(); entity.getSimpleShort(); entity.getSimpleInt(); entity.getSimpleLong(); entity.getSimpleFloat(); entity.getSimpleDouble(); entity.getSimpleString(); entity.getSimpleByteArray(); } stopClock(Benchmark.Type.BATCH_ACCESS); startClock(); deleteAll(); stopClock(Benchmark.Type.BATCH_DELETE); }