[squeak-dev] The Inbox: Graphics-nice.446.mcz

Levente Uzonyi leves at caesar.elte.hu
Wed Feb 17 17:26:53 UTC 2021


On Wed, 17 Feb 2021, Marcel Taeumel wrote:

> Hmm... looking at performance ... why not just add #asSequenceableCollection, which would only impact Set arguments?

I don't think we have such method. Adding one would raise the usual 
question: should it create a new collection or return self if self 
already to the requested collection kind?
IIRC currently the only outlier is #asOrderedCollection which always 
creates a copy when the receiver is an OrderedCollection, and that 
property is being relied on, so it can't be changed...

> As a programmer, I do not want to choose between #merge: and #quickMerge:. Or similar. :-)

IMO, we simply need one quick solution. If you have a Set, you may need 
that help from the library even more.
#quickMerge: is only good for merging two rectangles. It does not solve 
the GC issue #merge: has.


Levente

> 
> Best,
> Marcel
>
>       Am 13.02.2021 17:05:07 schrieb commits at source.squeak.org <commits at source.squeak.org>:
>
>       Nicolas Cellier uploaded a new version of Graphics to project The Inbox:
>       http://source.squeak.org/inbox/Graphics-nice.446.mcz
>
>       ==================== Summary ====================
>
>       Name: Graphics-nice.446
>       Author: nice
>       Time: 13 February 2021, 5:04:52.453325 pm
>       UUID: d13c1db2-370f-4fa6-b7ae-e6766bf0c8fb
>       Ancestors: Graphics-dtl.445
>
>       Let Rectangle merging:/encompassing: an unordered collection.
>
>       =============== Diff against Graphics-dtl.445 ===============
>
>       Item was changed:
>       ----- Method: Rectangle class>>encompassing: (in category 'instance creation') -----
>       encompassing: listOfPoints
>       "A number of callers of encompass: should use this method."
>       | topLeft bottomRight |
>       + topLeft := bottomRight := listOfPoints anyOne.
>       + listOfPoints do:
>       - topLeft := bottomRight := listOfPoints first.
>       - listOfPoints allButFirstDo:
>       [:p |topLeft := topLeft min: p.
>       + bottomRight := bottomRight max: p].
>       - bottomRight := bottomRight max: p].
>       ^self origin: topLeft corner: bottomRight
>       !
>
>       Item was changed:
>       ----- Method: Rectangle class>>merging: (in category 'instance creation') -----
>       merging: listOfRects
>       "A number of callers of merge: should use this method."
>       + | aRectangle bottomRight topLeft |
>       + aRectangle := listOfRects anyOne.
>       + topLeft := aRectangle topLeft.
>       + bottomRight := aRectangle bottomRight.
>       - | bottomRight topLeft |
>       - topLeft := listOfRects first topLeft.
>       - bottomRight := listOfRects first bottomRight.
>       listOfRects
>       + do: [:r | topLeft := topLeft min: r topLeft.
>       - allButFirstDo: [:r | topLeft := topLeft min: r topLeft.
>       bottomRight := bottomRight max: r bottomRight].
>       ^self origin: topLeft corner: bottomRight.
>       !
> 
> 
> 
>


More information about the Squeak-dev mailing list