UUID>>hash should be removed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

UUID>>hash should be removed

Runar Jordahl
UUID [7.7.1 - 2] included in "preview" for VisualWorks 7.8.1 should
probably have UUID>>hash removed. The method considers only a few of
the bytes in the UUID, which under "normal" circumstances is OK.
However, Oracle-generated UUIDs happen to mostly differ on bytes
outside the bytes used in the function.

The best solution would be to remove UUID>>hash and rely on the super
class' (ByteArray) implementation. In ByteArray, primitive 1700 is
used. My limited tests shows that it performs faster than UUID>>hash.

The following code can be used to test performance:

|id|
id := UUID version4.
[10000000 timesRepeat: [id hash] ] millisecondsToRun

Kind regards,
Runar Jordahl
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: UUID>>hash should be removed

Andres Valloud-6
Hmmm, yeah, that looks like it makes sense.

65593: "Delete UUID>>hash"

On 6/26/2012 2:29 AM, Runar Jordahl wrote:

> UUID [7.7.1 - 2] included in "preview" for VisualWorks 7.8.1 should
> probably have UUID>>hash removed. The method considers only a few of
> the bytes in the UUID, which under "normal" circumstances is OK.
> However, Oracle-generated UUIDs happen to mostly differ on bytes
> outside the bytes used in the function.
>
> The best solution would be to remove UUID>>hash and rely on the super
> class' (ByteArray) implementation. In ByteArray, primitive 1700 is
> used. My limited tests shows that it performs faster than UUID>>hash.
>
> The following code can be used to test performance:
>
> |id|
> id := UUID version4.
> [10000000 timesRepeat: [id hash] ] millisecondsToRun
>
> Kind regards,
> Runar Jordahl
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: UUID>>hash should be removed

Andres Valloud-6
In reply to this post by Runar Jordahl
I also would like to point out that sometimes hash function evaluation
speed is not the most important factor that drives hashed collection
performance.  As an extreme example,

hash

        ^1


is super fast but useless.  More than once I've replaced hash functions
with something e.g. 5x slower, just to see overall application
performance go from 30 minutes of computation to just 90 seconds and
hashed collection activity can't be found in the profiler...


On 6/26/2012 2:29 AM, Runar Jordahl wrote:

> UUID [7.7.1 - 2] included in "preview" for VisualWorks 7.8.1 should
> probably have UUID>>hash removed. The method considers only a few of
> the bytes in the UUID, which under "normal" circumstances is OK.
> However, Oracle-generated UUIDs happen to mostly differ on bytes
> outside the bytes used in the function.
>
> The best solution would be to remove UUID>>hash and rely on the super
> class' (ByteArray) implementation. In ByteArray, primitive 1700 is
> used. My limited tests shows that it performs faster than UUID>>hash.
>
> The following code can be used to test performance:
>
> |id|
> id := UUID version4.
> [10000000 timesRepeat: [id hash] ] millisecondsToRun
>
> Kind regards,
> Runar Jordahl
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: UUID>>hash should be removed :-)

Reinout Heeck-2
On 6/28/2012 8:46 AM, Andres Valloud wrote:

> I also would like to point out that sometimes hash function evaluation
> speed is not the most important factor that drives hashed collection
> performance.  As an extreme example,
>
> hash
>
> ^1
>
>
> is super fast but useless.

Oh, perhaps you should switch to using random numbers with this technique:

     http://imgs.xkcd.com/comics/random_number.png


;-)




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: UUID>>hash should be removed :-)

Andres Valloud-4
I know where that came from :)...

On 6/28/12 0:27 , Reinout Heeck wrote:

> On 6/28/2012 8:46 AM, Andres Valloud wrote:
>> I also would like to point out that sometimes hash function evaluation
>> speed is not the most important factor that drives hashed collection
>> performance.  As an extreme example,
>>
>> hash
>>
>> ^1
>>
>>
>> is super fast but useless.
>
> Oh, perhaps you should switch to using random numbers with this technique:
>
>       http://imgs.xkcd.com/comics/random_number.png
>
>
> ;-)
>
>
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc