mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-27 14:30:00 -06:00
Speed up the loading of row data a bit
This improves the performance for loading row data with my setup by about 10%. Incidentally, the conversion from Qt to STL containers reduced the performance by about the same number.
This commit is contained in:
@@ -234,18 +234,18 @@ void RowLoader::process (Task & t)
|
||||
|
||||
while(!t.cancel && sqlite3_step(stmt) == SQLITE_ROW)
|
||||
{
|
||||
Cache::value_type rowdata;
|
||||
// Construct a new row object with the right number of columns
|
||||
Cache::value_type rowdata(static_cast<size_t>(num_columns));
|
||||
for(int i=0;i<num_columns;++i)
|
||||
{
|
||||
if(sqlite3_column_type(stmt, i) == SQLITE_NULL)
|
||||
// No need to do anything for NULL values because we can just use the already default constructed value
|
||||
if(sqlite3_column_type(stmt, i) != SQLITE_NULL)
|
||||
{
|
||||
rowdata.emplace_back();
|
||||
} else {
|
||||
int bytes = sqlite3_column_bytes(stmt, i);
|
||||
if(bytes)
|
||||
rowdata.emplace_back(static_cast<const char*>(sqlite3_column_blob(stmt, i)), bytes);
|
||||
rowdata[static_cast<size_t>(i)] = QByteArray(static_cast<const char*>(sqlite3_column_blob(stmt, i)), bytes);
|
||||
else
|
||||
rowdata.emplace_back("");
|
||||
rowdata[static_cast<size_t>(i)] = "";
|
||||
}
|
||||
}
|
||||
QMutexLocker lk(&cache_mutex);
|
||||
|
||||
Reference in New Issue
Block a user