Hello Everybody,

I’m facing a strange performance degradation from SQLite 3.10 to 3.13.
The code posted below is around 10 times slower in a release build for 64bit.
Two Visual Studio projects where the problem can be reproduced can be 
downloaded here: https://drive.google.com/open?id=0B0DoU-QPegjkcDdkSVl6Rmp6cHM

Does anyone have an idea about the cause?

Best Regards,
Ralf

PS: I know that the code is not optimal. It’s just an example where the 
performance problem can be reproduced…

----------------------------------------------------------------------------------------
int main()
{
    sqlite3* db;

    int rc = sqlite3_open(":memory:", &db);
    if (rc != SQLITE_OK)
                return 1;

    const HANDLE  hProc = GetCurrentProcess();
    __int64  a, b, c, d;

    GetProcessTimes(hProc, (FILETIME*) &a, (FILETIME*) &b, (FILETIME*) &c, 
(FILETIME*) &d);

    const double startTime = double(c+d) / 10000000.0;

    const char createStmt[] = "create table tTest (UsrRowID Text, Column2 
Integer, Column3 Real, Column4 Text)";

    sqlite3_stmt* pLocalStmt;
    const char*   zTail;
    rc = sqlite3_prepare_v2(db, createStmt, -1, &pLocalStmt, &zTail);
    if (rc != SQLITE_OK)
    {
                puts(sqlite3_errmsg(db));
                return 1;
    }

    rc = sqlite3_step(pLocalStmt);
    if (rc != SQLITE_DONE)
                return 1;

    sqlite3_finalize(pLocalStmt);

    const char insertStmt[] = "insert into tTest values (?1, ?2, ?3, ?4)";

    for (int i = 0; i < 400000; i++)
    {
                rc = sqlite3_prepare_v2(db, insertStmt, -1, &pLocalStmt, 
&zTail);
                if (rc != SQLITE_OK)
                    return 1;

                rc = sqlite3_bind_text(pLocalStmt, 1, "UsrRow_", -1, 
SQLITE_TRANSIENT);
                rc = sqlite3_bind_int(pLocalStmt, 2, 1);
                rc = sqlite3_bind_double(pLocalStmt, 3, 8.5);
                rc = sqlite3_bind_text(pLocalStmt, 4, "ExampleText_", -1, 
SQLITE_TRANSIENT);

                rc = sqlite3_step(pLocalStmt);
                if (rc != SQLITE_DONE)
                    return 1;

                sqlite3_finalize(pLocalStmt);
    }

    sqlite3_close_v2(db);

    GetProcessTimes(hProc, (FILETIME*) &a, (FILETIME*) &b, (FILETIME*) &c, 
(FILETIME*) &d);

    const double processTime = double(c+d) / 10000000.0 - startTime;
    printf("Process Time = %f\n", processTime);

    puts("Press <Return> to exit");
    getchar();

    return 0;
}


-----------------
Siemens Industry Software GmbH; Anschrift: Franz-Geuer-Str. 10, 50823 Köln; 
Gesellschaft mit beschränkter Haftung; Geschäftsführer: Urban August, Daniel 
Trebes; Sitz der Gesellschaft: Köln; Registergericht: Amtsgericht Köln, HRB 
84564
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to