slow FreeCell (was: Re: Morphic slow in 2.8 (was:Forecast))

Paul McDonough wnchips at yahoo.com
Tue Oct 10 15:22:28 UTC 2000


I haven't been following this (or, really, any) thread
lately, so I'm not sure if this'll help.

Whilst enjoying a recent exploratory journey through
the innards of HandMorph, I noticed a spot where a
simplifying assumption looked safe.  Implementing it
doesn't *seem* to have killed anything, and dragging
behavior looks a bit faster now, at least in an
environment where morphs overlay e/o more than one or
two deep.  More importantly, the "event storms" have
abated considerably, and the level of general
morph-confusion has subsided with them.  I expect
these results to be highly platform-dependent, so take
it all with a grain of salt, etc., etc.  But at least
it Does No Harm.

Method:  HandMorph>>dragOverList:

Assumption:  since this is only sent when something's
dragging, and since the only sender of this method is
going to filter out the morphs which aren't d/d
enabled, it's ok to leave those morphs out of the
list.

Reimplementation:
!HandMorph methodsFor: 'event handling' stamp: 'pnm
10/9/2000 9:55'!
dragOverList: evt
	| p roots mList mm root |
	p _ evt cursorPoint.
	roots _ self world rootMorphsAt: p.  "root morphs in
world"
	roots isEmpty
		ifTrue: [^EmptyArray]
		ifFalse: [root _ roots first].
	mList _ root dropMorphsAt: p.
	mList size > 0 ifTrue:
		["NOTE: We really only want the top morph and all
its owners"
		mm _ mList first.
		mList _ OrderedCollection new.
		[mm == root] whileFalse:
			[mList addLast: mm.
			mm _ mm owner].
		mList add: root].
	^ mList! !

!Morph methodsFor: 'submorphs-accessing' stamp: 'pnm
10/8/2000 13:48'!
dropMorphsAt: aPoint
	"Return a collection of all morphs in this morph
structure that contain the given point, possibly
including the receiver itself.  The order is deepest
embedding first."

	^ self dropMorphsAt: aPoint addTo: OrderedCollection
new! !

!Morph methodsFor: 'submorphs-accessing' stamp: 'pnm
10/10/2000 07:50'!
dropMorphsAt: aPoint addTo: mList
	"Return a collection of all morphs in this morph
structure that contain the given point, possibly
including the receiver itself.  Must do this
recursively because of transforms.  "
	submorphs size > 0 ifTrue:
		[submorphs do: [:m | m dropMorphsAt: aPoint addTo:
mList]].
	(self dropEnabledAt: aPoint) ifTrue: [mList addLast:
self].
	^ mList! !

!Morph methodsFor: 'private' stamp: 'pnm 10/10/2000
07:50'!
dropEnabledAt: aPoint

	^(self dropEnabled or: [self dragNDropEnabled])
		and: [self containsPoint: aPoint]! !

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/





More information about the Squeak-dev mailing list