The Trunk: Collections-nice.570.mcz

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

The Trunk: Collections-nice.570.mcz

commits-2
Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.570.mcz

==================== Summary ====================

Name: Collections-nice.570
Author: nice
Time: 25 May 2014, 12:37:21.454 am
UUID: 1069cfcc-6bd7-4d7d-87fb-0a0a546f8a0c
Ancestors: Collections-nice.569

Let's optimize a bit LinkedList>>at:ifAbsent: by scanning the list only once, unlike super.

=============== Diff against Collections-nice.569 ===============

Item was added:
+ ----- Method: LinkedList>>at:ifAbsent: (in category 'accessing') -----
+ at: index ifAbsent: exceptionBlock
+ "Optimized to scan the list once, super would twice."
+ | i |
+ index < 1 ifTrue: [^exceptionBlock value].
+ i := 0.
+ self do: [:link |
+ (i := i + 1) = index ifTrue: [^ link]].
+ ^exceptionBlock value!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-nice.570.mcz

Nicolas Cellier
Once again, I pushed this un-essential 3 years old change to trigger another CI build...
If the build fails, don't worry, there are many other un-essential changes I did.
Why do you think I keep my images and use the update stream?


2014-05-25 0:38 GMT+02:00 <[hidden email]>:
Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.570.mcz

==================== Summary ====================

Name: Collections-nice.570
Author: nice
Time: 25 May 2014, 12:37:21.454 am
UUID: 1069cfcc-6bd7-4d7d-87fb-0a0a546f8a0c
Ancestors: Collections-nice.569

Let's optimize a bit LinkedList>>at:ifAbsent: by scanning the list only once, unlike super.

=============== Diff against Collections-nice.569 ===============

Item was added:
+ ----- Method: LinkedList>>at:ifAbsent: (in category 'accessing') -----
+ at: index ifAbsent: exceptionBlock
+       "Optimized to scan the list once, super would twice."
+       | i |
+       index < 1 ifTrue: [^exceptionBlock value].
+       i := 0.
+       self do: [:link |
+               (i := i + 1) = index ifTrue: [^ link]].
+       ^exceptionBlock value!





Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-nice.570.mcz

Tobias Pape

On 25.05.2014, at 00:42, Nicolas Cellier <[hidden email]> wrote:

> Once again, I pushed this un-essential 3 years old change to trigger another CI build...
> If the build fails, don't worry, there are many other un-essential changes I did.
> Why do you think I keep my images and use the update stream?
>
>

Strangely, I like this pattern very much!


> 2014-05-25 0:38 GMT+02:00 <[hidden email]>:
> Nicolas Cellier uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-nice.570.mcz
>
> ==================== Summary ====================
>
> Name: Collections-nice.570
> Author: nice
> Time: 25 May 2014, 12:37:21.454 am
> UUID: 1069cfcc-6bd7-4d7d-87fb-0a0a546f8a0c
> Ancestors: Collections-nice.569
>
> Let's optimize a bit LinkedList>>at:ifAbsent: by scanning the list only once, unlike super.
>
> =============== Diff against Collections-nice.569 ===============
>
> Item was added:
> + ----- Method: LinkedList>>at:ifAbsent: (in category 'accessing') -----
> + at: index ifAbsent: exceptionBlock
> +       "Optimized to scan the list once, super would twice."
> +       | i |
> +       index < 1 ifTrue: [^exceptionBlock value].
> +       i := 0.
> +       self do: [:link |
> +               (i := i + 1) = index ifTrue: [^ link]].
> +       ^exceptionBlock value!
>
>
>
>



signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-nice.570.mcz

Chris Muller-3
>> Once again, I pushed this un-essential 3 years old change to trigger another CI build...
>> If the build fails, don't worry, there are many other un-essential changes I did.
>> Why do you think I keep my images and use the update stream?
>>
>>
>
> Strangely, I like this pattern very much!

Me too!  It's like redeeming a 2-for-1 coupon..  :-)