Catalin Ghita
Catalin Ghita

Reputation: 826

Adding Firebase reduces app overall speed

I have built an app that searches for books using Google Books API. Its' functionality stands in a search bar that queries for some particular books and them displays them in a Listview. I then decided to add Firebase as a cloud backend for my app.

Note: Before adding Firebase my app took around 1 sec to retrieve information and display searched books in the ListView (for first search) and approx. 500ms to any after searches.

After implementing Firebase(added sign up and log in activities and xmls that lead to the main activity that actually searches for books) I started to experience unpleasant waiting time.

From couple of seconds for a simple log-in to around 5 seconds for first query and display (of books) and 4 seconds for any after queries and displays of books (that is around 5 times slower comparing to older version of the app without Firebase).

I am posting the App-level Build.gradle file for info purposes:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
    applicationId "com.example.android.booktrade_v10"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
 }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

Do you guys have any ideas why my app started being so slow?

Any help is appreciated.

Upvotes: 0

Views: 473

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598728

After implementing Firebase (added sign up and log in activities

These operations require that the Firebase SDK connects to its servers, validates the user account, and creates a token. This takes time.

Upvotes: 1

Related Questions