diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-20 12:48:13 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-20 12:48:13 +0000 |
commit | d363c51d46ee4cd1775ea5b28a50b80175e25dcc (patch) | |
tree | 633673262bd2cbf8dfbd2010ce8cc99b2711626a /plugins/Dbx_mdb/src/dbintf.cpp | |
parent | f764743b3f58209720f3c9d97884f05eed642150 (diff) |
dbx_lmdb: speed optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16314 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbintf.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbintf.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp index cb044d622f..a036f5090f 100644 --- a/plugins/Dbx_mdb/src/dbintf.cpp +++ b/plugins/Dbx_mdb/src/dbintf.cpp @@ -33,11 +33,6 @@ static int OfsCompare(const ModuleName *mn1, const ModuleName *mn2) return (mn1->ofs - mn2->ofs);
}
-static int stringCompare2(const char *p1, const char *p2)
-{
- return strcmp(p1, p2);
-}
-
CDbxMdb::CDbxMdb(const TCHAR *tszFileName, int iMode) :
m_safetyMode(true),
m_bReadOnly((iMode & DBMODE_READONLY) != 0),
@@ -45,7 +40,7 @@ CDbxMdb::CDbxMdb(const TCHAR *tszFileName, int iMode) : m_dwMaxContactId(1),
m_lMods(50, ModCompare),
m_lOfs(50, OfsCompare),
- m_lResidentSettings(50, stringCompare2)
+ m_lResidentSettings(50, strcmp)
{
m_tszProfileName = mir_tstrdup(tszFileName);
InitDbInstance(this);
@@ -98,7 +93,6 @@ int CDbxMdb::Load(bool bSkipInit) mdb_open(trnlck, "eventsrt", MDB_CREATE | MDB_INTEGERKEY, &m_dbEventsSort);
mdb_open(trnlck, "settings", MDB_CREATE, &m_dbSettings);
-
DWORD keyVal = 1;
MDB_val key = { sizeof(DWORD), &keyVal }, data;
if (mdb_get(trnlck, m_dbGlobal, &key, &data) == MDB_SUCCESS) {
@@ -121,6 +115,14 @@ int CDbxMdb::Load(bool bSkipInit) }
trnlck.commit();
+ {
+ mdb_txn_begin(m_pMdbEnv, nullptr, MDB_RDONLY, &m_txn);
+ mdb_cursor_open(m_txn, m_dbEvents, &m_curEvents);
+ mdb_cursor_open(m_txn, m_dbEventsSort, &m_curEventsSort);
+ mdb_txn_reset(m_txn);
+ }
+
+
if (InitModuleNames()) return EGROKPRF_CANTREAD;
if (InitCrypt()) return EGROKPRF_CANTREAD;
|