summaryrefslogtreecommitdiff
path: root/src/rabbit_basic.erl
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-01-17 12:19:31 +0000
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-01-17 12:19:31 +0000
commit065f57944a56b7d8183dfa04761247b5b760fdef (patch)
treee02ac8b53fe9b947306053118e56b148ff4f2a69 /src/rabbit_basic.erl
parentaea58d91b22163ee8cee76ce8d4b62224ebfa0e7 (diff)
downloadrabbitmq-server-065f57944a56b7d8183dfa04761247b5b760fdef.tar.gz
Split guid/0 in guid/0 and the faster fast_guid/0.
The first function works like the old one (hashes the {serial, counter} each time. The second function (fast_guid/0) hashes the serial once, and the XORs it with the counter each time a new guid is needed. Thus, it is more predictable but should not produce less unique guids. If the fast function is used when generating ids for messages, it leads to a considerable speedup when testing with BroadcastMain (from 67k msg/s to 75k msg/s).
Diffstat (limited to 'src/rabbit_basic.erl')
-rw-r--r--src/rabbit_basic.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl
index b116821c..0af35134 100644
--- a/src/rabbit_basic.erl
+++ b/src/rabbit_basic.erl
@@ -139,7 +139,7 @@ message(XName, RoutingKey, #content{properties = Props} = DecodedContent) ->
{ok, #basic_message{
exchange_name = XName,
content = strip_header(DecodedContent, ?DELETED_HEADER),
- id = rabbit_guid:guid(),
+ id = rabbit_guid:fast_guid(),
is_persistent = is_message_persistent(DecodedContent),
routing_keys = [RoutingKey |
header_routes(Props#'P_basic'.headers)]}}