[squeak-dev] The Inbox: Collections-cmm.872.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jan 22 05:36:56 UTC 2020


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)!



More information about the Squeak-dev mailing list