Hi Max,

That's a interesting library thanks.

Does the library guarantee monotonically increasing IDs? Eg protection 
against clock reset and other clock fluctuations?

Another thing I've noticed is that you are using (System/currentTimeMillis) to 
get the wall clock on every generation.

(System/currentTimeMillis) causes a low level system call which in turn 
causes a context switch.

Maybe one way to improve could be use a initial (System/currentTimeMillis) 
on the first init! and then
use System/nanoTime to calculate the time elapsed from the init.
The advantage would be that System/nanoTime runs in the UserSpace (not 
Kernel Space) and it doesn't require
a system call (so no context switch).

This could really help the case of a bulk production of IDs and any other 
burst situation.

Bruno 


On Friday, June 3, 2016 at 4:40:26 PM UTC+1, Max Countryman wrote:
>
> Hi Mark,
>
> I haven’t done any benchmarking comparing Flakes to UUIDs. However the 
> primary benefit of flake IDs, over a traditional UUID, e.g. UUID-1, is 
> flakes do not require coordination (i.e. to avoid clock-skew and duplicate 
> IDs), provide k-ordering (UUID-1’s bit ordering breaks this), and use the 
> standard Unix epoch. It would be interesting to compare performance, but 
> the features of flakes are certainly their primary selling points.
>
>
> Max
>
> On Jun 2, 2016, at 20:38, Mark Engelberg <mark.en...@gmail.com 
> <javascript:>> wrote:
>
> This is interesting.  Is it faster than uuid for generation and/or 
> comparing for equality?
>
> On Thu, Jun 2, 2016 at 6:03 PM, Max Countryman <ma...@me.com <javascript:>
> > wrote:
>
>> Hi,
>>
>> I’m happy to announce a new release of Flake, the decentralized, 
>> k-ordered unique ID generator.
>>
>> Flake 0.4.0 includes a number of important breaking changes, but by far 
>> the most important is dropping `generate` in favor of `generate!` which now 
>> returns a ByteBuffer. Previously `generate` returned a BigInteger, however 
>> this arbitrarily limits how an application can handle IDs and goes against 
>> the spirit of the Erlang implementation. In order to maintain backwards 
>> compatibility, a helper `flake->bigint` was added to the core namespace. 
>> Applications which already consume flakes should update their calls to 
>> `generate` so they are `generate!` and wrap them with `flake->bigint` if 
>> BigIntegers are desirable or already used.
>>
>> Github: https://github.com/maxcountryman/flake
>> Changes: https://github.com/maxcountryman/flake/blob/master/CHANGELOG.md
>>
>> Thanks!
>>
>>
>> Max
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com <javascript:>
> Note that posts from new members are moderated - please be patient with 
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+u...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to