Skip to content

Commit 1fb18d9

Browse files
Better result output also for cupboard, ORMLite indexed tests.
1 parent cad7e93 commit 1fb18d9

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

PerformanceTests/Cupboard/src/androidTest/java/de/greenrobot/performance/cupboard/PerformanceTestCupboard.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public class PerformanceTestCupboard extends ApplicationTestCase<Application> {
2222
private static final String TAG = "PerfTestCupboard";
2323

2424
private static final int BATCH_SIZE = 10000;
25+
private static final int QUERY_COUNT = 1000;
2526
private static final int RUNS = 8;
26-
private static final int INDEXED_RUNS = 1000;
2727

2828
private static final String DATABASE_NAME = "cupboard.db";
2929
private static final int DATABASE_VERSION = 1;
@@ -92,10 +92,10 @@ public void doIndexedStringEntityQuery() {
9292
Log.d(TAG, "Inserted entities.");
9393

9494
// query for entities by indexed string at random
95-
int[] randomIndices = StringGenerator.getFixedRandomIndices(INDEXED_RUNS, BATCH_SIZE - 1);
95+
int[] randomIndices = StringGenerator.getFixedRandomIndices(QUERY_COUNT, BATCH_SIZE - 1);
9696

9797
long start = System.currentTimeMillis();
98-
for (int i = 0; i < INDEXED_RUNS; i++) {
98+
for (int i = 0; i < QUERY_COUNT; i++) {
9999
int nextIndex = randomIndices[i];
100100
//noinspection unused
101101
List<IndexedStringEntity> query = database.query(
@@ -104,7 +104,9 @@ public void doIndexedStringEntityQuery() {
104104
.list();
105105
}
106106
long time = System.currentTimeMillis() - start;
107-
Log.d(TAG, "Queried for " + INDEXED_RUNS + " indexed entities in " + time + " ms");
107+
Log.d(TAG,
108+
"Queried for " + QUERY_COUNT + " of " + BATCH_SIZE + " indexed entities in " + time
109+
+ " ms.");
108110

109111
// delete all entities
110112
database.delete(IndexedStringEntity.class, "");

PerformanceTests/OrmLite/src/androidTest/java/de/greenrobot/performance/ormlite/PerformanceTestOrmLite.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public class PerformanceTestOrmLite extends ApplicationTestCase<Application> {
1818
private static final String TAG = "PerfTestOrmLite";
1919

2020
private static final int BATCH_SIZE = 10000;
21+
private static final int QUERY_COUNT = 1000;
2122
private static final int RUNS = 8;
22-
private static final int INDEXED_RUNS = 1000;
2323

2424
private boolean inMemory;
2525
private DbHelper dbHelper;
@@ -102,10 +102,10 @@ public Void call() throws Exception {
102102
Log.d(TAG, "Inserted entities.");
103103

104104
// query for entities by indexed string at random
105-
int[] randomIndices = StringGenerator.getFixedRandomIndices(INDEXED_RUNS, BATCH_SIZE - 1);
105+
int[] randomIndices = StringGenerator.getFixedRandomIndices(QUERY_COUNT, BATCH_SIZE - 1);
106106

107107
long start = System.currentTimeMillis();
108-
for (int i = 0; i < INDEXED_RUNS; i++) {
108+
for (int i = 0; i < QUERY_COUNT; i++) {
109109
int nextIndex = randomIndices[i];
110110
//noinspection unused
111111
List<IndexedStringEntity> query = dao.queryBuilder()
@@ -115,7 +115,9 @@ public Void call() throws Exception {
115115
// ORMLite already builds all entities when executing the query, so move on
116116
}
117117
long time = System.currentTimeMillis() - start;
118-
Log.d(TAG, "Queried for " + INDEXED_RUNS + " indexed entities in " + time + " ms");
118+
Log.d(TAG,
119+
"Queried for " + QUERY_COUNT + " of " + BATCH_SIZE + " indexed entities in " + time
120+
+ " ms.");
119121

120122
// delete all entities
121123
dbHelper.getWritableDatabase().execSQL("DELETE FROM INDEXED_STRING_ENTITY");

0 commit comments

Comments
 (0)