ByteArray implements #hash but not #=

Ron Teitelbaum Ron at USMedRec.com
Sun Feb 25 19:09:55 UTC 2007


Hi Martin,

I dunno I've never noticed a performance problem with ByteArray #=.

| aCopy |
aCopy := self copy.

Time millisecondsToRun: [
	1 to: 1000 do: [:i | self = aCopy]]  

I took a 128 element byte array and ran #= a thousand times and the results
were only 14ms.  The comparison time seems linear but I'm not 100% sure
about that.  500 calls gives me 7ms.  

Ok so for the fun of it I did the same thing with War and Peace by Leo
Tolstoy.  A single comparison took 340ms.  100 times took: 34223.  That's
pretty linear.

Most of the work we do in the cryptography team is on small byteArrays so it
would be very important that we do not lose speed there from any changes in
implementation.

Ron Teitelbaum
Squeak Cryptography Team Leader

> From: Martin Kuball
> Sent: Sunday, February 25, 2007 8:27 AM
> Hi!
> 
> I'm just wondering why #= is not implemented in class ByteArray. Wouldn't
> it make sense to have a fast primitive for that instead of using the
> general implementation in class SequenceableCollection?
> 
> Martin
> 





More information about the Squeak-dev mailing list