[ 
https://issues.apache.org/jira/browse/MESOS-3046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14805182#comment-14805182
 ] 

haosdent commented on MESOS-3046:
---------------------------------

what's your clang version? Seems work for me.

My clang version
{code}
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
{code}

Could your compiler pass this code snippet directly.
{code}
#include <iostream>
#include <string>

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>

#ifdef __APPLE__
#define THREAD_LOCAL __thread
#else
#define THREAD_LOCAL thread_local
#endif

struct UUID : boost::uuids::uuid
{
public:
  static UUID random()
  {
    typedef boost::uuids::random_generator generator;
    static THREAD_LOCAL generator* uuid_generator = new generator();
    return UUID((*uuid_generator)());
  }

private:
  explicit UUID(const boost::uuids::uuid& uuid)
    : boost::uuids::uuid(uuid) {}
};

int main() {
  std::cout << UUID::random() << std::endl;
}
{code}

> Stout's UUID re-seeds a new random generator during each call to UUID::random.
> ------------------------------------------------------------------------------
>
>                 Key: MESOS-3046
>                 URL: https://issues.apache.org/jira/browse/MESOS-3046
>             Project: Mesos
>          Issue Type: Bug
>          Components: stout
>            Reporter: Benjamin Mahler
>            Assignee: Klaus Ma
>              Labels: newbie, twitter
>             Fix For: 0.25.0
>
>         Attachments: tl.cpp
>
>
> Per [~StephanErb] and [~kevints]'s observations on MESOS-2940, stout's UUID 
> abstraction is re-seeding the random generator during each call to 
> {{UUID::random()}}, which is really expensive.
> This is confirmed in the perf graph from MESOS-2940.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to