-
Notifications
You must be signed in to change notification settings - Fork 572
Closed
Description
Hi,
I have an issue with performance of sqlcipher 4.0.1 on Android 7.x
Inserts of big amounts of records in one transactions are ~10 times slower on sqlcipher 4.0.1 then on 3.5.9
Here is my sample app I'm using to measure performance:
`class MainActivity : AppCompatActivity() {
var database: SQLiteDatabase? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initSqlCipher()
createSchema()
insert()
}
fun initSqlCipher() {
SQLiteDatabase.loadLibs(this)
val databaseFile = getDatabasePath("demo.db")
databaseFile.mkdirs()
databaseFile.delete()
database = SQLiteDatabase.openOrCreateDatabase(databaseFile, "test123", null)
}
private fun insert() {
val startTime= System.currentTimeMillis()
database?.execSQL("begin;")
(1..10000).forEach {
database?.execSQL("insert into some_table(name, surname) values(?, ?)",
arrayOf<Any>("one for the money", "two for the show"))
}
database?.execSQL("commit;")
Log.e("SchemaLog", "Inserted in: ${System.currentTimeMillis() - startTime} ms")
}
fun createSchema() {
val startTime= System.currentTimeMillis()
database?.execSQL("""CREATE TABLE some_table (
name TEXT,
surname TEXT)""".trimIndent())
Log.e("SchemaLog", "Schema created in: ${System.currentTimeMillis() - startTime} ms")
}
}`
raiym
Metadata
Metadata
Assignees
Labels
No labels