Hi guys
I spent 3 hours looking for improvement in MC1.5. (of course I got
problem when loading the code - but this can be fixed)
When I could load it, it is indeed much faster.
Finally And matthew nicely pointed me to his improvement.
I will have a look at the specific speedup made by matthew and see if
I can make that work.
Now instead of extracting a speedup from that code (and looking like a
thief)
I would prefer that we do a task force and check MC1.6 improve it
clean it if necessary.
So does anybody with knowledge want to help on that topic?
Stef
Here is my conversation with matthew
Hi matthew
could you give me some hints abotu what I should look for?
Because I loaded these two files I found on
http://installer.pbworks.com/LevelPlayingField-Monticello15
But this is not that simple to spot changes.
I'd rather you just used MC1.5 rather than port it, but ok
There are two speedups in Monticello 1.6:
Scanning the class heiarchy looking for package elements is 10x
faster, due to a rewrite of the scanning code.
Loading is 3-6x faster, especially for large packages, due to
the atomic loader.
I believe you can't make much use of the second, as the atomic
loader doesn't support traits yet.
The rewritten scanning code is in class PackageInfo, category
single-pass. To merge it into Monticello, simply call
PackageInfo >> classesDo:methodsDo:displayingProgress: from
MCPackage >> snapshot. Attached is a changeset of the relevant
code, extracted from mc1.6. You may have to slightly modify
MCPackage >> snapshot, as it contains instructions for
interacting with the Orphanage, which I'm guessing your branch
of Monticello does not include.
--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
'From Croquet1.0beta of 11 April 2006 [latest update: #2] on 15 July 2009 at 3:27:12 pm'!
!MCPackage methodsFor: 'as yet unclassified' stamp: 'kph 12/7/2008 03:31'!
snapshot
| definitions categories packageInfo |
packageInfo := self packageInfo.
definitions := OrderedCollection new.
categories := packageInfo systemCategories.
definitions addAll: (self orphanage orphansFor: packageInfo).
definitions removeAllFoundIn: self orphanage unlinkedClasses.
categories isEmpty ifFalse: [ definitions add: (MCOrganizationDefinition categories: categories) ].
packageInfo
classesDo: [:ea | definitions addAll: ea classDefinitions]
methodsDo: [:ea | definitions add: ea asMethodDefinition]
displayingProgress: 'Snapshotting...'.
MCScriptDefinition subclassesDo: [ :ea | ea from: packageInfo addTo: definitions ].
MCFileDefinition from: packageInfo addTo: definitions.
^ MCSnapshot fromDefinitions: definitions
! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 21:37'!
behaviorsNamed: aSymbol do: aBlock
"Enumerates all behaviors with the given name"
| class traitClass |
class := Smalltalk at: aSymbol ifAbsent: [^ self].
class isBehavior ifTrue: [aBlock value: class. aBlock value: class class. ^ self].
traitClass := Smalltalk at: #Trait ifAbsent: [^ self].
(class isKindOf: traitClass) ifTrue: [aBlock value: class. ^ self].! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 20:45'!
classesDo: classBlock methodsDo: methodBlock
"Enumerates all non-meta classes and all methods in the package"
self
includedClassesDo: [:class |
class isMeta ifFalse: [classBlock value: class].
self methodsInIncludedClass: class do: methodBlock]
excludedClassesDo: [:class |
self methodsInExcludedClass: class do: methodBlock]! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 23:18'!
classesDo: classBlock methodsDo: methodBlock displayingProgress: aString
"Enumerates all non-meta classes and all methods in the package, and displays a progress bar"
| classes methods i |
(1 to: 2) do: [:ignored | ] displayingProgress: 'Collecting...'.
classes := OrderedCollection new.
methods := OrderedCollection new.
self
classesDo: [:class | classes add: class]
methodsDo: [:method | methods add: method].
aString displayProgressAt: Sensor cursorPoint
from: 1 to: classes size + methods size
during: [:bar | i := 0.
classes do: [:class | bar value: (i := i + 1). classBlock value: class].
methods do: [:method | bar value: (i := i + 1). methodBlock value: method]]! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 20:22'!
includedClassesDo: includedBlock excludedClassesDo: excludedBlock
"Enumerates behaviors, dividing them into included and excluded"
self
includedSystemCategoriesDo: [:cat |
(SystemOrganization listAtCategoryNamed: cat) do: [:name |
self behaviorsNamed: name do: includedBlock]]
excludedSystemCategoriesDo: [:cat |
(SystemOrganization listAtCategoryNamed: cat) do: [:name |
self behaviorsNamed: name do: excludedBlock]]! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 21:37'!
includedSystemCategoriesDo: includedBlock excludedSystemCategoriesDo: excludedBlock
"Enumerate all system categories, dividing them into included and excluded"
SystemOrganization categories do: [:ea | (self includesSystemCategory: ea)
ifTrue: [includedBlock value: ea]
ifFalse: [excludedBlock value: ea]]! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 20:58'!
methodCategoriesInClass: aClass
coreDo: coreBlock
extensionDo: extensionBlock
overrideDo: overrideBlock
"Enumerates all interesting categories in aClass. Core categories go to coreBlock. My extension categories and override categories go to extensionBlock. Foreign override categories go to overrideBlock. Foreign extension categories are ignored"
aClass organization categories do: [:cat |
(self isYourClassExtension: cat) ifTrue: [extensionBlock value: cat]
ifFalse: [(self isOverrideCategory: cat) ifTrue: [overrideBlock value: cat]
ifFalse: [(self isForeignClassExtension: cat) ifFalse: [coreBlock value: cat]]]]! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/4/2008 00:54'!
methodsInClass: aClass category: aCategory do: aBlock
"Enumerate the methods in the given class and category"
(aClass organization listAtCategoryNamed: aCategory) do: [:selector |
aBlock value: ((self referenceForMethod: selector ofClass: aClass) category: aCategory)]! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 21:37'!
methodsInExcludedClass: aClass do: aBlock
"Enumerate my methods in excluded class aClass"
self methodCategoriesInClass: aClass
coreDo: [:cat | "nothing"]
extensionDo: [:cat | self methodsInClass: aClass category: cat do: aBlock]
overrideDo: [:cat | self overriddenMethodsInClass: aClass category: cat do: aBlock]! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 21:37'!
methodsInIncludedClass: aClass do: aBlock
"Enumerate my methods in included class aClass"
self methodCategoriesInClass: aClass
coreDo: [:cat | self methodsInClass: aClass category: cat do: aBlock]
extensionDo: [:cat | self methodsInClass: aClass category: cat do: aBlock]
overrideDo: [:cat | self overriddenMethodsInClass: aClass category: cat do: aBlock]! !
!PackageInfo methodsFor: 'single-pass' stamp: 'mtf 10/3/2008 21:46'!
overriddenMethodsInClass: aClass category: aCategory do: aBlock
"Enumerate the methods in the given class and category"
self methodsInClass: aClass category: aCategory do: [:methodRef |
(self changeRecordForOverriddenMethod: methodRef)
ifNotNilDo: [:changeRecord | aBlock value: changeRecord]]! !
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project