Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem.Data.Sqlite (C#) vs. Sqlite (C) performance
    primarykey
    data
    text
    <p>Situation: The .Net client app (C#, Mono) downloads data from the web service (SOAP) and stores it into an Sqlite DB. The DB interface is System.Data.Sqlite that under the hood uses sqlite3.dll. </p> <p>The DB (130 MB) has a few dozens of tables. One table is particularly large and takes 90% of the DB size - 10000 of records with some blob columns. (Largest blob has 260K.)</p> <p>Download on the iPad takes 22 min. When I commented out actual writing into DB, it took some 11 min, so it looks like the DB takes about 11 min, too. By "DB" I mean some layer above System.Data.Sqlite. Don't know the details yet. All I know is that all DB commands are in a transaction and there are just a few transactions involved. (In other words transactions are not a problem.)</p> <p>When I dumped the DB using Sqlite shell and measured the C code that calls sqlite3_exec() with the dumped string (this code is far from being optimal), I got about 50 secs (iPad). It means sqlite C code can create the DB very fast.</p> <p>Another interesting problem: The download is organized table by table. All the tables (some of them having a few MB) work ok. Except the largest table, where the download had to be reorganized to a few items (5) at a time. Without this measure the download failed with insufficient memory. Most probable explanation is memory fragmentation. (Mono has problems with GC and does not provide good memory info.)</p> <p>My feeling is that the download process itself is responsible for a smaller part of the problem. It downloads roughly the same size as the DB. Fragmentation should not be the problem. But the single-thread organization adds on the latency.</p> <p>However, I feel that the biggest problem is the data processing in the application. </p> <ul> <li>It has to parse several protocols (http, SOAP, Xml) </li> <li>The data processing in System.Data.Sqlite and calling sqlite3.dll. This probably involves allocations, marshalling etc.</li> </ul> <p>We'll be doing more tests later, but right now I would like to ask you for ideas. For example I would welcome performance comparison of System.Data.Sqlite vs. raw Sqlite. Anybody?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload