I'm not sure i'm using the efficient way to manipulate large number of strings. I need to open a large file (~35kb) and parse and manipulate every line, ex:
a1="Name surname"
a2="Name surname"
a3="Name surname"
...
a800="Name surname"
I need to insert into a sqlite db every Name surname with the current id as index.
while ((s = d.readLine()) != null){
String[] name = s.split("\"");
String[] arrIdTemp = s.split("=");
String[] arrtId = arrIdTemp[0].split("a");
db.execSQL("INSERT INTO " + Constant.DB.DB_NAME
+ " Values ('" + arrtId[1] + "','" + name[1]
+ "');");
}
In this way i create 3 string arrays and for the first 100 lines is quite fast, but at the end the whole operation is slowing down, maybe because of a large use of memory? Is there a better solution to split and manipulate every line?
Logcat output says lots of:
01-27 14:46:50.554: D/dalvikvm(2541): GC_CONCURRENT freed 1778K, 68% free 3606K/11079K, external 4662K/5822K, paused 4ms+7ms