Repository: mesos
Updated Branches:
  refs/heads/master 31adac43c -> d5d44d123


Fixed a performance issue in UUID generation.

Stout's UUID abstraction is re-seeding the random generator
during each call to UUID::random(), which is really expensive.

Review: https://reviews.apache.org/r/38102


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d5d44d12
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d5d44d12
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d5d44d12

Branch: refs/heads/master
Commit: d5d44d1230e9a459a4e32cf3d24f3b4819f27f13
Parents: 31adac4
Author: Klaus Ma <[email protected]>
Authored: Thu Sep 17 20:43:27 2015 -0700
Committer: Benjamin Mahler <[email protected]>
Committed: Thu Sep 17 20:48:51 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d5d44d12/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp
index e90dabb..67f1984 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/uuid.hpp
@@ -23,12 +23,17 @@
 #include <boost/uuid/uuid_generators.hpp>
 #include <boost/uuid/uuid_io.hpp>
 
+#include <stout/thread_local.hpp>
+
 struct UUID : boost::uuids::uuid
 {
 public:
   static UUID random()
   {
-    return UUID(boost::uuids::random_generator()());
+    static THREAD_LOCAL boost::uuids::random_generator* generator =
+      new boost::uuids::random_generator();
+
+    return UUID((*generator)());
   }
 
   static UUID fromBytes(const std::string& s)

Reply via email to