Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ActiveAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ repositories {
}

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion Common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.library'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion Couchbase/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion Cupboard/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion DBFlow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ repositories {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion Firebase/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion OrmLite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion Parse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion Realm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion Room/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
5 changes: 2 additions & 3 deletions SQLDelight/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ apply plugin: 'com.android.application'
apply plugin: 'com.squareup.sqldelight'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand All @@ -24,8 +23,8 @@ android {
dependencies {
androidTestCompile project(':Common')
compile dep.supportAnnotations
provided 'com.google.auto.value:auto-value:1.5.1'
provided 'javax.annotation:jsr250-api:1.0'
compileOnly 'com.google.auto.value:auto-value:1.5.1'
compileOnly 'javax.annotation:jsr250-api:1.0'

annotationProcessor 'com.google.auto.value:auto-value:1.5.1'
}
1 change: 0 additions & 1 deletion Sqlite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 0 additions & 1 deletion SquiDB/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
apply plugin: 'com.android.application'

android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
Expand Down
1 change: 1 addition & 0 deletions SugarORM/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
37 changes: 37 additions & 0 deletions SugarORM/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"


defaultConfig {
applicationId "de.greenrobot.performance.sugarorm"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:+', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation project(path: ':Common')
implementation 'com.github.satyan:sugar:1.5'
}
21 changes: 21 additions & 0 deletions SugarORM/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package de.greenrobot.performance.sugarorm;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import com.orm.SugarRecord;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.ArrayList;
import java.util.List;

import de.greenrobot.performance.BasePerfTestCase;
import de.greenrobot.performance.Benchmark;

import static org.junit.Assert.*;

/**
* @see <a href="http://satyan.github.io/sugar/creation.html">Getting started with Sugar ORM</a>
*/
@RunWith(AndroidJUnit4.class)
public class PerfTestSugarorm extends BasePerfTestCase {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("de.greenrobot.performance.sugarorm", appContext.getPackageName());
}

@Override
protected void doOneByOneCrudRun(int count) throws Exception {
final List<SimpleEntityNotNull> list = new ArrayList<>();

for (long i = 0; i < count; i++)
list.add(createSimpleEntityNotNull(i));

startClock();
for (int i = 0; i < count; i++) {
list.get(i).save();
}
stopClock(Benchmark.Type.ONE_BY_ONE_CREATE);

startClock();
for (int i = 0; i < count; i++) {
SimpleEntityNotNull.findById(SimpleEntityNotNull.class, i).save();
}
stopClock(Benchmark.Type.ONE_BY_ONE_UPDATE);

deleteAll(SimpleEntityNotNull.class);
}

@Override
protected void doBatchCrudRun(int count) throws Exception {
final List<SimpleEntityNotNull> list = new ArrayList<>();

for (long i = 0; i < count; i++) {
list.add(createSimpleEntityNotNull(i));
}

startClock();
SugarRecord.saveInTx(list);
stopClock(Benchmark.Type.BATCH_CREATE);

startClock();
SugarRecord.updateInTx(list);
stopClock(Benchmark.Type.BATCH_UPDATE);

startClock();
List<SimpleEntityNotNull> reloaded = SugarRecord.listAll(SimpleEntityNotNull.class);
stopClock(Benchmark.Type.BATCH_READ);

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.getReplaceByteArray();
}
stopClock(Benchmark.Type.BATCH_ACCESS);

startClock();
deleteAll(SimpleEntityNotNull.class);
stopClock(Benchmark.Type.BATCH_DELETE);
}

private static SimpleEntityNotNull createSimpleEntityNotNull(Long key) {
if (key == null) {
return null;
}
SimpleEntityNotNull entity = new SimpleEntityNotNull();
entity.setId(key);
entity.setSimpleBoolean(true);
entity.setSimpleByte(Integer.MAX_VALUE);
entity.setSimpleShort(Short.MAX_VALUE);
entity.setSimpleInt(Integer.MAX_VALUE);
entity.setSimpleLong(Long.MAX_VALUE);
entity.setSimpleFloat(Float.MAX_VALUE);
entity.setSimpleDouble(Double.MAX_VALUE);
entity.setSimpleString("greenrobot greenDAO");
entity.replaceByteArray = "42, -17, 23, 0, 127, -128";
return entity;
}

private static <T extends SugarRecord> void deleteAll(Class<T> type) {
SugarRecord.deleteAll(type);
}
}
17 changes: 17 additions & 0 deletions SugarORM/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.greenrobot.performance.sugarorm">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="com.orm.SugarApp" >
<meta-data android:name="DATABASE" android:value="sugarorm.db"/>
<meta-data android:name="VERSION" android:value="1" />
<meta-data android:name="QUERY_LOG" android:value="false" />
<meta-data android:name="DOMAIN_PACKAGE_NAME" android:value="de.greenrobot.performance.sugarorm"/>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package de.greenrobot.performance.sugarorm;

import com.orm.dsl.Table;
import com.orm.dsl.Unique;

@Table
public class IndexedStringEntity {
@Unique
long id;
String indexedString;

public IndexedStringEntity(long id, String indexedString) {
this.id = id;
this.indexedString = indexedString;
}

public IndexedStringEntity() {
}
}
Loading