[Glass] UUID new is pretty slow ...

Martin McClure via Glass glass at lists.gemtalksystems.com
Tue Jun 30 13:12:45 PDT 2015


On 06/30/2015 07:53 AM, itlists at schrievkrom.de via Glass wrote:
> ... I was not aware of it. I created 11000 objects from a CSV file and
> to get IDs within these objects I use the UUID class of Gemstone.
> 
>  It took very long and I found out, that the creation of the 11000
> objects took pretty long ... until I found, that "UUID new" was the
> reason for that. It is very expensive. Calling this method 11000 times
> took 5.1s (average).
> 
>  I now use native libraries from Linux and now creating 11000 UUIDs
> takes around 0.3 to 0.5 seconds.
> 

I think the current GemStone implementation of UUID generation was taken
from Squeak a number of years ago. I took a look at how it's
implemented, and it's done just about the slowest way imaginable. So I
made a simpler, faster implementation. I believe it's compatible with
the existing implementation, just faster. Attached is a replacement for
the class UUIDGenerator that is almost 100x faster -- I can generate
11000 UUIDs in about 0.02 seconds with pure Smalltalk, so it might be
even faster than using native libraries.

This was done on the latest unreleased GemStone, but will probably work
in any 3.x version. If you try it, let me know what results you get.

Regards,

-Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UUIDGenerator.gs
Type: text/x-genie
Size: 2380 bytes
Desc: not available
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150630/3fd070ef/attachment.bin>


More information about the Glass mailing list