Hi Roger,
  thank for your answer. I tried to modify programs to match your
suggestion, performances improved but are still far from pyhon's ones.
(Sorry if this message starts a different thread but i had forwards of
single messages disabled so i could not reply to the original post)

---- C modified source and timing -----
bash-3.1$ diff test.c testold.c
9c9
<   sqlite3_open("test1.sqlite", &db);
---
>   sqlite3_open("testDB.sql", &db);
45c45
<   for(i=0;i<1024*8;i++)data[i]='0'+i%10;
---
>   for(i=0;i<1024*8;i++)data[i]='0';
61c61
<     if(SQLITE_OK!=(ret=sqlite3_bind_text(db_stm, 3, data,-1,
---
>     //if(SQLITE_OK!=(ret=sqlite3_bind_text(db_stm, 3, data,-1,
63c63
<     //if(SQLITE_OK!=(ret=sqlite3_bind_blob(db_stm, 3, data,8192,
---
>     if(SQLITE_OK!=(ret=sqlite3_bind_blob(db_stm, 3, data,8192,


bash-3.1$ gcc -O2 test.c sqlite/sqlite3.c && time ./a.exe
[...]

real    1m58.056s
user    0m0.015s
sys     0m0.015s

---- Python's timing (another run, i'm looking at time tool statistic
not at timeit module so they include also startup times)
bash-3.1$ time python testsqlite.py
[...]

real    0m30.906s
user    0m0.015s
sys     0m0.000s

---- Trying the other way round (making python's code same as old C code)
bash-3.1$ diff testsqlite.py testsqlite_old.py
12c12
< conn = sqlite3.connect('testDB.sql')
---
> conn = sqlite3.connect('test1.sqlite')
51c51
<   data=buffer("00000000"*1024)
---
>   data="01234567"*1024
bash-3.1$ time python testsqlite.py
[...]
real    0m30.421s
user    0m0.015s
sys     0m0.015s
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to