The Trunk: Monticello-ul.332.mcz

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

The Trunk: Monticello-ul.332.mcz

commits-2
Andreas Raab uploaded a new version of Monticello to project The Trunk:
http://source.squeak.org/trunk/Monticello-ul.332.mcz

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

Name: Monticello-ul.332
Author: ul
Time: 11 November 2009, 9:23:53 am
UUID: 7126e560-709c-b94c-84d9-cda50c54037f
Ancestors: Monticello-ul.331

- speed up MCFileRepositoryInspector by improving #packageList and caching the result. (~25x speedup with a respository of ~500 package versions of ~160 packages)

=============== Diff against Monticello-ul.331 ===============

Item was changed:
  ----- Method: MCFileRepositoryInspector>>packageList (in category 'morphic ui') -----
  packageList
+
+ | result loadedPackages |
+ packageList ifNotNil: [ ^packageList ].
+ result := Set new: versions size.
+ versions do: [ :each | result add: each first ].
- | result |
- result := versions
- inject: Set new
- into: [ :set :each | set add: each first; yourself ].
-
- "sort loaded packages first, then alphabetically"
- result := result asSortedCollection: [:a :b |
- | loadedA loadedB |
- loadedA := loaded anySatisfy: [:each | (each copyUpToLast: $-) = a].
- loadedB := loaded anySatisfy: [:each | (each copyUpToLast: $-) = b].
- loadedA = loadedB
- ifTrue: [a < b]
- ifFalse: [loadedA]].
 
+ "sort loaded packages first, then alphabetically"
+ loadedPackages := Set new: loaded size.
+ loaded do: [ :each |
+ loadedPackages add: (each copyUpToLast: $-) ].
+ result := result asArray sort: [ :a :b |
+ | loadedA loadedB |
+ loadedA := loadedPackages includes: a.
+ loadedB := loadedPackages includes: b.
+ loadedA = loadedB
+ ifTrue: [ a < b ]
+ ifFalse: [ loadedA ] ].
+
+ ^packageList := result collect: [ :each | self packageHighlight: each ]!
- ^result collect: [:each | self packageHighlight: each]!

Item was changed:
  ----- Method: MCFileRepositoryInspector>>refresh (in category 'as yet unclassified') -----
  refresh
  | packageNames name latest av |
  packageNames := Set new.
+ packageList := nil.
  versions := repository readableFileNames collect: [ :each |
  name := (each copyUpToLast: $.) copyUpTo: $(.
  name last isDigit ifFalse: [Array with: name with: '' with: '' with: each]
  ifTrue:
  [Array
  with: (packageNames add: (name copyUpToLast:  $-)) "pkg name"
  with: ((name copyAfterLast: $-) copyUpTo: $.) "user"
  with: ((name copyAfterLast: $-) copyAfter: $.) asInteger "version"
  with: each]].
  versions := versions select: [:each | (each at: 3) isNumber].
  newer := Set new.
  inherited := Set new.
  loaded := Set new.
  (MCWorkingCopy allManagers
  " select: [ :each | packageNames includes: each packageName]")
  do: [:each |
  each ancestors do: [ :ancestor |
  loaded add: ancestor name.
  ancestor ancestorsDoWhileTrue: [:heir |
  (inherited includes: heir name)
  ifTrue: [false]
  ifFalse: [inherited add: heir name. true]]].
  latest := (versions select: [:v | v first = each package name])
  detectMax: [:v | v third].
  (latest notNil and: [
  each ancestors allSatisfy: [:ancestor |
  av := ((ancestor name copyAfterLast: $-) copyAfter: $.) asInteger.
  av < latest third or: [
  av = latest third and: [((ancestor name copyAfterLast: $-) copyUpTo: $.) ~= latest second]]]])
  ifTrue: [newer add: each package name ]].
 
  self changed: #packageList; changed: #versionList!

Item was changed:
  MCVersionInspector subclass: #MCFileRepositoryInspector
+ instanceVariableNames: 'repository versions loaded newer inherited selectedPackage selectedVersion order versionInfo packageList'
- instanceVariableNames: 'repository versions loaded newer inherited selectedPackage selectedVersion order versionInfo'
  classVariableNames: 'Order'
  poolDictionaries: ''
  category: 'Monticello-UI'!