summaryrefslogtreecommitdiff
path: root/zen/guid.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2018-05-08 23:58:22 +0200
committerDaniel Wilhelm <shieldwed@outlook.com>2018-05-08 23:58:22 +0200
commitd9af47022b5eb44effe5bfb6e2acfa8dff54a7a6 (patch)
tree0e492ea3976c5908c7323cac3e73ebb6fdd65085 /zen/guid.h
parent9.1 (diff)
downloadFreeFileSync-d9af47022b5eb44effe5bfb6e2acfa8dff54a7a6.tar.gz
FreeFileSync-d9af47022b5eb44effe5bfb6e2acfa8dff54a7a6.tar.bz2
FreeFileSync-d9af47022b5eb44effe5bfb6e2acfa8dff54a7a6.zip
9.2
Diffstat (limited to 'zen/guid.h')
-rwxr-xr-xzen/guid.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/zen/guid.h b/zen/guid.h
index d88578a6..b34c3cbf 100755
--- a/zen/guid.h
+++ b/zen/guid.h
@@ -20,9 +20,11 @@ namespace zen
inline
std::string generateGUID() //creates a 16-byte GUID
{
- boost::uuids::uuid nativeRep = boost::uuids::random_generator()();
- //generator is only thread-safe like an int, so we keep it local until we need to optimize perf
- //perf: generator: 0.22ms per call; retrieve GUID: 0.12µs per call
+ //perf: generator: 0.38ms per creation;
+ // retrieve GUID: 0.13µs per call
+ //generator is only thread-safe like an int => keep thread-local
+ thread_local boost::uuids::random_generator gen;
+ const boost::uuids::uuid nativeRep = gen();
return std::string(nativeRep.begin(), nativeRep.end());
}
}
bgstack15