question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Realm is too slow on Android first call when compared to iOS

See original GitHub issue

Goal

What do you want to achieve? Faster return for realm.getInstance() call the first time it is executed

Expected Results

I am noticing the iOS Realm is much faster at returning the Realm Instance the first time it is called, significantly faster (with the same schema setup).

Actual Results

I am noticing it takes upwards of 1 second on the Samsung s8. On some devices it takes up to 8-9 seconds.

Steps & Code to Reproduce

Describe your current debugging efforts. Please run this (https://github.com/abhi-scenedoc/realmTest) sample project that I have put together which displays the results (time taken is ms).

Code Sample


long startTime = System.currentTimeMillis();
Realm realm = Realm.getDefaultInstance(); //first time it's called after application is opened
long result = (System.currentTimeMillis() - startTime);
Log.d(REALM, "total time = " + result);

Version of Realm and tooling

Realm version(s): 3.7.2(testing) and 3.3.1 (in our production app)

Realm sync feature enabled:no

Android Studio version: 2.3.3

Which Android version and device: Samsung S8 - Android 7.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:32 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
jasper-chancommented, Mar 15, 2018

+1

This is a very concerning issue for us to deal with. Are there any updates in regards to this? We have a major customer who have indefinitely postponed going live on our production because of this challenge.

1reaction
abhi-scenedoccommented, Mar 5, 2018

Any update on this? I need a more comparative result to Realm for iOS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are single transactions so slow? - Stack Overflow
2 Answers 2 · For every write, you are re-opening the database (i.e. within storeInDb you are calling Realm. · You shouldn't need...
Read more >
The things I've learned using Realm | by Gabor Varadi - Medium
In this article, I try to sum up all the things I've learned from using Realm, and how it all relates with the...
Read more >
Why does an Android phone slow down with time but iOS ...
Well, it is a common view that Android slows down with time compared to iOS, there are a few reasons for this view....
Read more >
Realistic Realm - lessons learned after using it for 1.5 years
Android application has been written in Kotlin from the very beginning, used offline-first approach, i.e. when all the data displayed on the ...
Read more >
Realm: Create reactive mobile apps in a fraction of the time
Apps using Realm can target both iOS and Android. React Native 0.31.0 and later is supported. Installation. Create a new React Native project:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found