Variations in execution time for Android database operations [migrated]

view full story

http://unix.stackexchange.com – I am measuring the execution time of methods that open and close a database, as well as performing a query and an insert on it. For each one of these four operations I basically get the time before and after the execution of the relevant statement like this: for(int i = 0; i < 500; i++) { startTime = System.nanoTime(); long insertResult = db.insert(tableName, null, contentValues); endTime = System.nanoTime(); if(insertResult > -1) { generateNoteOnSD(fileName, (endTime - startTime)); } } In the case of the insert: The minimum execution time in the sample (HowTos)