Digit wrote:
> I think 63 ms == 0.063 s, so the difference is about 120:1 which really
> looks a bit surprising here, even taking the ARM emulation into account.
>
> can you post a small code snippet (and/or even an example database file) to
> duplicate this ?
>

Here:

package sqlite.test;

import java.io.File;
import java.io.IOException;
import java.util.Date;

import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import android.os.Bundle;
import android.os.Debug;
import android.util.Log;

public class SqliteTest extends Activity {
    /** Called when the activity is first created. */
        final static String TAG = "sqlitetest";

    @Override
    public void onCreate(Bundle icicle) {
        Debug.startMethodTracing("/tmp/x");
        super.onCreate(icicle);
        System.out.println("Here!");
        setContentView(R.layout.main);
        SQLiteDatabase db = null;
        File f=null;
                try {
                        f = File.createTempFile("test", null);
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                db = SQLiteDatabase.create(f, 1, null);
        db.execSQL("BEGIN");
        db.execSQL("DROP TABLE If EXISTS links;");
        db.execSQL("CREATE TABLE links (_id INTEGER PRIMARY KEY, sup
INTEGER, sub INTEGER)");
        SQLiteStatement st = db.compileStatement("INSERT INTO links
(sub, sup) VALUES (?, ?)");
        for(int i=0;i<1000;i++){
                st.bindLong(1, (long)Math.random());
                st.bindLong(2, (long)Math.random());
                st.execute();
        }
        db.execSQL("END");
        Log.i(TAG, " ready ");
        long time = new Date().getTime();
        Cursor c = db.query("links", null, null, null, null, null,
null);
        Log.i(TAG, "Queried in " + (new Date().getTime() - time) + "
ms");
        long sum = 0;
        boolean fst = true;
        while(c.next()){
                if(fst){
                        Log.i(TAG, "First next in " + (new Date().getTime() - 
time)
+ " ms");
                        fst = false;
                }
                sum += c.getLong(1) * c.getLong(2);
        }
        Log.i(TAG, "Done in " + (new Date().getTime() - time) + "
ms");
        Log.i(TAG, " = " + sum);
        c.close();
        Debug.stopMethodTracing();
    }
}

Output was
Queried in 59 ms
First next in 314 ms
Done in 6930 ms
 = 20568

That's in debug, in run that was 41, 204, 4104, (and 20036:) )

Traceview is corrupt.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to