A new version of Monticello was added to project The Inbox:
http://source.squeak.org/inbox/Monticello-ul.540.mcz ==================== Summary ==================== Name: Monticello-ul.540 Author: ul Time: 4 May 2013, 12:38:19.766 am UUID: 680a6c25-2cf1-4b13-97fc-082a237109fc Ancestors: Monticello-fbs.539 Speed up updating the Trunk by: - caching #allVersionNames when #allFileNames is cached (so we just calculate them once instead of 134 times) - speeding up a method of MCVersionName a bit (there's lots of space for optimization in that class) Renamed the instance variable allFileNames of MCFileBasedRepository to allFileNamesCache, because it's just a cache. =============== Diff against Monticello-fbs.539 =============== Item was changed: MCRepository subclass: #MCFileBasedRepository + instanceVariableNames: 'cache allFileNamesCache allVersionNamesCache' - instanceVariableNames: 'cache allFileNames' classVariableNames: '' poolDictionaries: '' category: 'Monticello-Repositories'! Item was changed: ----- Method: MCFileBasedRepository>>allFileNamesOrCache (in category 'private-files') ----- allFileNamesOrCache + + ^allFileNamesCache ifNil: [ self allFileNames ]! - ^ allFileNames ifNil: [self allFileNames]! Item was changed: ----- Method: MCFileBasedRepository>>allVersionNames (in category 'private-files') ----- allVersionNames + ^allVersionNamesCache ifNil: [ + self readableFileNames collect: [ :each | each versionName ] ]! - ^self readableFileNames collect: [ :each | each versionName ]! Item was changed: ----- Method: MCFileBasedRepository>>cacheAllFileNamesDuring: (in category 'private') ----- cacheAllFileNamesDuring: aBlock + "Cache the result of #allFileNames and #allVersionNames during aBlock" + + allFileNamesCache ifNotNil: [ ^aBlock value ]. + allFileNamesCache := self allFileNames. + allVersionNamesCache := self allVersionNames. + ^aBlock ensure: [ allFileNamesCache := allVersionNamesCache := nil ]! - allFileNames ifNotNil:[^aBlock value]. - allFileNames := self allFileNames. - ^ aBlock ensure: [allFileNames := nil]! Item was changed: ----- Method: MCFileBasedRepository>>flushCache (in category 'private') ----- flushCache + + cache := allFileNamesCache := allVersionNamesCache := nil! - cache := allFileNames := nil! Item was changed: ----- Method: MCFileBasedRepository>>includesVersionNamed: (in category 'versions') ----- includesVersionNamed: aString + | comparable | comparable := ((aString endsWith: '.mcz') and: [ aString size > 4 ]) + ifTrue: [ aString allButLast: 4 ] - ifTrue: - [ aString - copyFrom: 1 - to: aString size - 4 ] ifFalse: [ aString ]. ^ self allVersionNames includes: comparable! Item was changed: ----- Method: MCVersionName>>versionName (in category 'accessing') ----- versionName "Answer my version name as a ByteString, without the file suffix or any ancestor-attributes." | end | self isEmpty ifTrue: [^ String empty]. end := self indexOf: $( ifAbsent: [ + (self size > 4 + and: [ (self at: self size - 3) == $. + and: [ (self at: self size - 2) == $m + and: [ (self at: self size - 1) == $c ] ] ]) + ifTrue: [self size - 3] + ifFalse: [self size + 1]]. - (self size > 4 and: [(self copyFrom: self size - 3 to: self size - 1) = '.mc']) - ifTrue: [self size - 3] - ifFalse: [self size + 1]]. ^self first: end - 1! |
Free forum by Nabble | Edit this page |