performance - Speed issues using H2 database with OrmLite on Android -
i coding android app needs database. won't use sqlite because want pure java core without dependencies androids library. simplify database access i'm using ormlite.
so i've compared ormlite android examples helloandroid , helloandroidh2. i've reduced functionality of both examples read operations. test tables(2 colums, primary_key;value) contains 2 datasets.
the result:
- sqlite: results appears immediately
- h2: needs 2 seconds load results.
where mistake or correct? h2 need such long time load 2 small datasets? other experiences?
opening h2 database using default options relatively slow on android, as documented. there few ways improve that, of them documented in android section of h2:
- file_lock=fs (to use native file locking; saves @ least 20 ms)
- page_size=1024 (using smaller page size seems improve performance here)
- cache_size=8192 (to avoid using heap memory cache)
also quite important using empty user name , password. if don't, password hashed, relatively slow on android.
but in case think not able same opening speed sqlite in near future, sorry.
Comments
Post a Comment