[Mono-dev] GUID generation

Jonathan Chambers joncham at gmail.com
Fri Jul 27 17:16:34 EDT 2007


Hello,

      pinvoking the the CoCreateGuid function from ole32.dll results in a
time of 225 ms for mono. You could use that on Windows and libuuid on Linux
(I didn't try it's performance).

- Jonathan

On 7/27/07, Robert Jordan <robertj at gmx.net> wrote:
>
> pablosantosluac wrote:
> > This fix looks good (performance wise)
> >
> > I don't understand why it is taking so long... Specially taking into
> account that the old sun blade almost needs the same time... (it is about
> 5000 bogomips...:-P)
> >
> > Any idea why the .net implementation is faster?
>
> Because MS.NET is probably p/invoking the unmanaged COM UUID
> generation API.
>
> Robert
>
> >
> > thanks,
> >
> > pablo
> >
> >
> >   ----- Original Message -----
> >   From: Jonathan Chambers
> >   To: pablosantosluac
> >   Cc: mono-devel-list at lists.ximian.com
> >   Sent: Friday, July 27, 2007 7:18 PM
> >   Subject: Re: [Mono-dev] GUID generation
> >
> >
> >   Hello,
> >
> >   A quick test on my Xeon 3.6GHz reveals the following for me for
> generating a million GUIDs:
> >
> >   .Net: 300 ms
> >   mono: 2300 ms
> >   mono (modified): 1875 ms
> >
> >   So, not quite sure why you see 8 seconds on your server. For the
> modified version, I simply made the byte array inside of NewGuid static
> (since we are already locking for the RNG) for some performance improvement.
> Can someone comment if that change is acceptable?
> >
> >   Thanks,
> >   Jonathan
> >
> >
> >   On 7/27/07, pablosantosluac <pablosantosluac at terra.es> wrote:
> >     Hi,
> >
> >     I need to generate a large number of GUIDs. I tried with my laptop
> and a
> >     .net console application and it can generate about 1million GUIDs in
> about
> >     480ms.
> >
> >     Then I tried the same with mono and it needed 3.4 seconds.
> >
> >     My surprise was trying on our Server (Intel(R) Xeon(TM) CPU 3.00GHz)
> where I
> >     got the following results:
> >
> >     8 seconds to generate a million of GUIDs.
> >
> >     Surprinsingly my old Sun Blade 1000 took almost the same time
> (Solaris 10
> >     SPARC): 9 seconds.
> >
> >     I guess there is a reason why .NET implements faster GUID generation
> but, is
> >     there any other globally unique number generator for Mono/Linux
> which I can
> >     use? Also, any idea why the Xeon (which is much, much faster than
> both the
> >     laptop and the Solaris box) is so slooow generating GUIDs?
> >
> >     Thanks,
> >
> >     pablo
> >
> >     _______________________________________________
> >     Mono-devel-list mailing list
> >     Mono-devel-list at lists.ximian.com
> >     http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070727/1ef79e6f/attachment.html 


More information about the Mono-devel-list mailing list