The Inbox: Collections-cmm.872.mcz

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

The Inbox: Collections-cmm.872.mcz

commits-2
Chris Muller uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-cmm.872.mcz

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

Name: Collections-cmm.872
Author: cmm
Time: 21 January 2020, 11:36:51.164974 pm
UUID: d1855708-4276-4201-a983-f8b49f71b988
Ancestors: Collections-ul.871

Let #new: *always* be a performance-improving choice over #new, when the correct size is known.

=============== Diff against Collections-ul.871 ===============

Item was changed:
  ----- Method: HashedCollection class>>new: (in category 'instance creation') -----
+ new: numberOfElements
+ "Create a Set large enough to hold numberOfElements without growing"
+ ^ self basicNew initialize:
+ (numberOfElements < 3
+ ifTrue: [ 3 ]
+ ifFalse:
+ [ numberOfElements < 5
+ ifTrue: [ 5 ]
+ ifFalse: [ self sizeFor: numberOfElements ] ])!
- new: nElements
- "Create a Set large enough to hold nElements without growing"
- ^ self basicNew initialize: (self sizeFor: nElements)!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Collections-cmm.872.mcz

Chris Muller-3
This accidental commit has been treated.

Please see Collections-cmm.873.


On Tue, Jan 21, 2020 at 11:37 PM <[hidden email]> wrote:
Chris Muller uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-cmm.872.mcz

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

Name: Collections-cmm.872
Author: cmm
Time: 21 January 2020, 11:36:51.164974 pm
UUID: d1855708-4276-4201-a983-f8b49f71b988
Ancestors: Collections-ul.871

Let #new: *always* be a performance-improving choice over #new, when the correct size is known.

=============== Diff against Collections-ul.871 ===============

Item was changed:
  ----- Method: HashedCollection class>>new: (in category 'instance creation') -----
+ new: numberOfElements
+       "Create a Set large enough to hold numberOfElements without growing"
+       ^ self basicNew initialize:
+               (numberOfElements < 3
+                       ifTrue: [ 3 ]
+                       ifFalse:
+                               [ numberOfElements < 5
+                                       ifTrue: [ 5 ]
+                                       ifFalse: [ self sizeFor: numberOfElements ] ])!
- new: nElements
-       "Create a Set large enough to hold nElements without growing"
-       ^ self basicNew initialize: (self sizeFor: nElements)!