[squeak-dev] The Trunk: Morphic-jl.1291.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Feb 13 16:57:43 UTC 2019


Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-jl.1291.mcz

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

Name: Morphic-jl.1291
Author: jl
Time: 30 August 2016, 5:37:57.236984 pm
UUID: b52cd418-d4de-3142-b2e1-2a53f002f6fc
Ancestors: Morphic-jl.1290

better performance when making lots of cloned players

=============== Diff against Morphic-jl.1290 ===============

Item was changed:
  ----- Method: Morph>>usableSiblingInstance (in category 'copying') -----
  usableSiblingInstance
  	"Return another similar morph whose Player is of the same class as mine.
  	Do not open it in the world."
  
+ 	| aName newPlayer newMorph topRenderer counter world |
- 	| aName usedNames newPlayer newMorph topRenderer |
  	(topRenderer := self topRendererOrSelf) == self 
  		ifFalse: [^topRenderer usableSiblingInstance].
  	self assuredPlayer assureUniClass.
  	newMorph := self veryDeepCopySibling.
  	newPlayer := newMorph player.
  	newPlayer resetCostumeList.
  	(aName := self knownName) isNil 
  		ifTrue: [self player notNil ifTrue: [aName := newMorph innocuousName]].
  	"Force a difference here"
+ 
+ 	aName := aName stemAndNumericSuffix at: 1. 
+ 	
+ 	world := self world ifNil: [Project current world].
+ 	(world hasProperty: #nameCounter) ifFalse: [
+ 		(world setProperty: #nameCounter toValue: Dictionary new)
+ 	].
+ 
+ 	counter := (world valueOfProperty: #nameCounter) at: aName ifAbsent: [1].
+ 	newMorph setNameTo: aName, counter.
+ 	(world valueOfProperty: #nameCounter)  at: aName put: counter + 1.
+ 
- 	aName notNil 
- 		ifTrue: 
- 			[usedNames := (self world ifNil: [OrderedCollection new]
- 						ifNotNil: [self world allKnownNames]) copyWith: aName.
- 			newMorph setNameTo: (Utilities keyLike: aName
- 						satisfying: [:f | (usedNames includes: f) not])].
  	newMorph privateOwner: nil.
  	newPlayer assureEventHandlerRepresentsStatus.
  	self presenter flushPlayerListCache.
  	^newMorph!



More information about the Squeak-dev mailing list