[squeak-dev] The Trunk: Collections-tfel.613.mcz
Chris Muller
asqueaker at gmail.com
Thu Apr 9 20:47:12 UTC 2015
I made a mistake in my earlier benching -- one image was Spur the
other was Cog, oops!
Still, there is a > 5% speed loss in byteAt:put:, which is strange
unless that prim is failing...
|ba| ba:= ByteArray new: 1.
[ba byteAt: 1 put: 200] bench
bf-612: '92,700,000 per second. 10.8 nanoseconds per run.'
tfel.613: '87,900,000 per second. 11.4 nanoseconds per run.'
What also is not so elegant is the inconsistency with ByteString.
ByteString>>#byteAt:put: ---> coercion on prim fail
ByteArray>>#byteAt:put: ---> no-coercion on prim fail
ByteString>>#at:put: ----> no-coercion on prim fail
ByteArray>>#at:put: ----> coercion on prim fail
IMHO, #at:put: should fail if the wrong type of argument is passed.
Also, I don't understand the change to ByteArray>>#byteAt:. Since
there is no #at: implementation in ByteArray, isn't the change to call
super unnecessary..?
On Thu, Apr 9, 2015 at 11:19 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> On 09.04.2015, at 17:16, Chris Muller <asqueaker at gmail.com> wrote:
>>
>> On Thu, Apr 9, 2015 at 10:11 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>>>>
>>>> Egads! This is a performance critical method that has now been slowed by half!
>>>>
>>>> old version: '94,500,000 per second. 10.6 nanoseconds per run.'
>>>> new version: '49,400,000 per second. 20.3 nanoseconds per run.'
>>>
>>> What exactly are you testing?
>>
>> |ba| ba:= ByteArray new: 1.
>> [ba byteAt: 1 put: 200] bench
>>
>> and
>>
>> |ba| ba:= ByteArray new: 1.
>> [ba at: 1 put: 200] bench
>
> These two are not equivalent. #at:put: is optimized by the VM.
>
> I would be very surprised if Tim's changes have any effect on performance one way or other. They're purely about correctness.
>
> To test, you would have to run the exact same code before and after updating.
>
> - Bert -
>
>
>
>
More information about the Squeak-dev
mailing list
|