[erlang-questions] Generating readable unique IDs for use outside erlang

Daniel Heidebrecht dan.heidebrecht@REDACTED
Thu Feb 10 17:48:08 CET 2011


hi,

i'm not sure about the performance of now().

from the rabbitmq rabbit_guid.erl inline comments:

%% We don't use erlang:now() here because a) it may return
%% duplicates when the system clock has been rewound prior to a
%% restart, or ids were generated at a high rate (which causes
%% now() to move ahead of the system time), and b) it is really
%% slow since it takes a global lock and makes a system call.

dan. 
On Thursday, February 10, 2011 at 9:45 AM, Dave Challis wrote:
On 10/02/11 14:47, Ale wrote:
> > > 
> > > Any suggestions on this?
> > 
> > Why don't you generate UUID?
> > http://en.wikipedia.org/wiki/Universally_unique_identifier
> 
> I mostly wanted to stick to the standard library for speed, I assumed 
> that calling the BIFs now() and node() would be much more efficient than 
> running code to generate a uuid.
> 
> Memory-wise, a tuple containing {node(), now()} should use up much less 
> space than a 128 bit uuid.
> 
> But good to know the code is out there, will come in handy someday I'm sure!
> 
> -- 
> Dave Challis
> dsc@REDACTED
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 


More information about the erlang-questions mailing list