[Glass] UUID new is pretty slow ...

Paul DeBruicker via Glass glass at lists.gemtalksystems.com
Tue Jun 30 07:54:39 PDT 2015


Hi Marten,

A few years ago I made a library that does just that:


MCHttpRepository
	location: 'http://smalltalkhub.com/mc/pdebruic/UUIDFFI/main'
	user: ''
	password: ''


I wish the search capabilities of Smalltalkhub were better.


Paul


GLASS mailing list 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.
> 
>  Solution goes via the external library "libuuid.so.1". With
> 
> fnUUIDGenerate
> 	"^
> <String>
>  "
> 
> 	^CCallout
> 		library: 'libuuid.so.1'
> 		name: 'uuid_generate'
> 		result: #void args: #(#ptr)
> 
> and
> 
> uuidGenerate
> 	"Prints a UUID value to base 62 (to get a short string)"
> 
> 	| temp num |
> 
> 	temp := CByteArray gcMalloc: (1 * 16).
> 	self fnUUIDGenerate callWith: (Array with: temp ).
> 
> 	num := 0.
> 	0 to: 15 do: [:i |
>           num := num + ((256 raisedTo: i) * (temp int8At: i))
>         ].
> 
> 	^num pumPrintStringRadix: 62 showRadix: false
> 
> -- 
> Marten Feldtmann
> _______________________________________________
> Glass mailing list

> Glass at .gemtalksystems

> http://lists.gemtalksystems.com/mailman/listinfo/glass





--
View this message in context: http://forum.world.st/UUID-new-is-pretty-slow-tp4834936p4834944.html
Sent from the GLASS mailing list archive at Nabble.com.


More information about the Glass mailing list