use of sqlite.feature.performance.simple.SimpleAddressItem in project kripton by xcesco.
the class Generator method getKriptonSimpleAddresses.
public static Collection<SimpleAddressItem> getKriptonSimpleAddresses(Class<SimpleAddressItem> itemClass, int count) {
Collection<SimpleAddressItem> addressItemCollection = new ArrayList<>();
for (int i = 0; i < count; i++) {
SimpleAddressItem addressItem = null;
addressItem = new SimpleAddressItem();
addressItem.setName("Test");
addressItem.setAddress("5486 Memory Lane");
addressItem.setCity("Bronx");
addressItem.setState("NY");
addressItem.setPhone(7185555555l);
addressItemCollection.add(addressItem);
}
return addressItemCollection;
}
use of sqlite.feature.performance.simple.SimpleAddressItem in project kripton by xcesco.
the class TestPerformanceRuntime method testRunSave.
@Test
public void testRunSave() {
// delete all
final BindSimpleDataSource dataSource = BindSimpleDataSource.instance();
dataSource.execute(new BindSimpleDataSource.Transaction() {
@Override
public TransactionResult onExecute(BindSimpleDaoFactory daoFactory) {
daoFactory.getSimpleAddressDao().deleteAll();
Collection<SimpleAddressItem> simpleAddressItems = Generator.getKriptonSimpleAddresses(SimpleAddressItem.class, LOOP_COUNT);
long insertDuration;
long insertOptimizedDuration;
// normal INSERT
{
log("insert NORMAL start");
long startTime = System.currentTimeMillis();
for (SimpleAddressItem simpleAddressItem : simpleAddressItems) {
daoFactory.getSimpleAddressDao().insert(simpleAddressItem);
}
insertDuration = System.currentTimeMillis() - startTime;
log("insert duration: %s", insertDuration);
}
// end
daoFactory.getSimpleAddressDao().deleteAll();
// optimized INSERT
{
log("insert OPTIZED start");
long startTime = System.currentTimeMillis();
for (SimpleAddressItem simpleAddressItem : simpleAddressItems) {
daoFactory.getSimpleAddressDao().insert(simpleAddressItem);
}
insertOptimizedDuration = System.currentTimeMillis() - startTime;
log("insert OPTIMIZED duration: %s", insertOptimizedDuration);
}
// end
return TransactionResult.COMMIT;
}
});
}
Aggregations