[git] GpgOL - branch, master, updated. gpgol-2.2.0-152-g94fd4b9

[email protected] (by Andre Heinecke)
Newsgroups gmane.comp.encryption.gpg.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  94fd4b9a6868bd25f91c040565ca8b8a0f6454f9 (commit)
      from  c9e39ec1bcc258a0208d2b9a2896c4ce415ac8df (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 94fd4b9a6868bd25f91c040565ca8b8a0f6454f9
Author: Andre Heinecke <[email protected]>
Date:   Tue Aug 28 12:20:55 2018 +0200

    Improve keycache performance a bit
    
    * src/keycache.cpp: Use unordered_map and set for better
    speed.

diff --git a/src/keycache.cpp b/src/keycache.cpp
index 95c27fe..58e7c67 100644
--- a/src/keycache.cpp
+++ b/src/keycache.cpp
@@ -31,7 +31,7 @@
 
 #include <windows.h>
 
-#include <map>
+#include <set>
 #include <unordered_map>
 #include <sstream>
 
@@ -483,9 +483,7 @@ public:
               int i = 0;
 
               gpgrt_lock_lock (&update_lock);
-              while (std::find (m_update_jobs.begin(), m_update_jobs.end(),
-                                sFpr)
-                     != m_update_jobs.end ())
+              while (m_update_jobs.find(sFpr) != m_update_jobs.end ())
                 {
                   i++;
                   if (i % 100 == 0)
@@ -539,15 +537,14 @@ public:
          }
        const std::string sFpr (fpr);
        gpgrt_lock_lock (&update_lock);
-       if (std::find (m_update_jobs.begin(), m_update_jobs.end(), sFpr)
-                      != m_update_jobs.end ())
+       if (m_update_jobs.find(sFpr) != m_update_jobs.end ())
          {
            log_debug ("%s:%s Update for \"%s\" already in progress.",
                       SRCNAME, __func__, fpr);
            gpgrt_lock_unlock (&update_lock);
          }
 
-       m_update_jobs.push_back (sFpr);
+       m_update_jobs.insert (sFpr);
        gpgrt_lock_unlock (&update_lock);
        update_arg_t * args = new update_arg_t;
        args->first = sFpr;
@@ -565,11 +562,8 @@ public:
         }
       TRACEPOINT;
       insertOrUpdateInFprMap (key);
-      const std::string sFpr (fpr);
       gpgrt_lock_lock (&update_lock);
-      const auto it = std::find (m_update_jobs.begin(),
-                                 m_update_jobs.end(),
-                                 sFpr);
+      const auto it = m_update_jobs.find(fpr);
 
       if (it == m_update_jobs.end())
         {
@@ -584,13 +578,13 @@ public:
       return;
     }
 
-  std::map<std::string, GpgME::Key> m_pgp_key_map;
-  std::map<std::string, GpgME::Key> m_smime_key_map;
-  std::map<std::string, GpgME::Key> m_pgp_skey_map;
-  std::map<std::string, GpgME::Key> m_smime_skey_map;
+  std::unordered_map<std::string, GpgME::Key> m_pgp_key_map;
+  std::unordered_map<std::string, GpgME::Key> m_smime_key_map;
+  std::unordered_map<std::string, GpgME::Key> m_pgp_skey_map;
+  std::unordered_map<std::string, GpgME::Key> m_smime_skey_map;
   std::unordered_map<std::string, GpgME::Key> m_fpr_map;
   std::unordered_map<std::string, std::string> m_sub_fpr_map;
-  std::vector<std::string> m_update_jobs;
+  std::set<std::string> m_update_jobs;
 };
 
 KeyCache::KeyCache():

-----------------------------------------------------------------------

Summary of changes:
 src/keycache.cpp | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.