Patrick Rein uploaded a new version of Traits to project The Inbox:
http://source.squeak.org/inbox/Traits-pre.312.mcz ==================== Summary ==================== Name: Traits-pre.312 Author: pre Time: 12 June 2019, 5:59:48.264868 pm UUID: f2ec63fa-f6e8-0347-a2c6-fb8623cb4a92 Ancestors: Traits-nice.311 This speeds up the compilation of methods in traits or in classes using traits by caching subsequent reads to the changes file. =============== Diff against Traits-nice.311 =============== Item was changed: ----- Method: ClassDescription>>updateTraits (in category '*Traits-NanoKernel') ----- updateTraits "Recompute my local traits composition" + CurrentReadOnlySourceFiles cacheDuring: [ + self installTraitsFrom: self traitComposition]! - self installTraitsFrom: self traitComposition. - ! Item was changed: ----- Method: TraitDescription>>addSelectorSilently:withMethod: (in category 'operations') ----- addSelectorSilently: selector withMethod: compiledMethod "Overridden to update the users of this trait" + CurrentReadOnlySourceFiles cacheDuring: [ + super addSelectorSilently: selector withMethod: compiledMethod. + self users do:[:each| each updateTraits]]! - super addSelectorSilently: selector withMethod: compiledMethod. - self users do:[:each| each updateTraits].! |
Hi, there. Thanks for finding this! +1 Are there more places where CurrentReadOnlySourceFiles >> #cacheDuring: should be used? How to find out? Best, Marcel
|
There might be a couple more of this as I saw some symptoms of this during debugging the other performance issue. My approach was quite primitve logging with the Transcript by instrumenting CurrentReadOnlySourceFIles like so:
cacheDuring: aBlock "Cache the read only source files on the first request and use them on subsequent requests during the evaluation of aBlock." | currentReadOnlySouceFiles | currentReadOnlySouceFiles := nil. ^aBlock on: self do: [ :exception | + Transcript showln: 'cached'. exception resume: (currentReadOnlySouceFiles ifNil: [ currentReadOnlySouceFiles := exception defaultAction ]) ] defaultAction "Return a read-only copy of SourceFiles." + Transcript showln: 'create new'. ^SourceFiles collect: [ :each | each ifNotNil: [ [ each readOnlyCopy ] on: FileDoesNotExistException do: [ :ex | nil "file does not exist happens in secure mode" ] ] ] And then digging deeper using the Profiler. However, this only became necessary as the editing of Traits and the TraitsTest became unbearingly slow at one point. (The main issue is currently categorizing the trait methods, not the compilation itself). Bests Patrick >Hi, there. >Thanks for finding this! +1 >Are there more places where CurrentReadOnlySourceFiles >> #cacheDuring: should be used? How to find out? >Best,Marcel > >Am 12.06.2019 17:59:59 schrieb [hidden email] <[hidden email]>:Patrick Rein uploaded a new version of Traits to project The Inbox: >http://source.squeak.org/inbox/Traits-pre.312.mcz > >==================== Summary ==================== > >Name: Traits-pre.312 >Author: pre >Time: 12 June 2019, 5:59:48.264868 pm >UUID: f2ec63fa-f6e8-0347-a2c6-fb8623cb4a92 >Ancestors: Traits-nice.311 > >This speeds up the compilation of methods in traits or in classes using traits by caching subsequent reads to the changes file. > >=============== Diff against Traits-nice.311 =============== > >Item was changed: >----- Method: ClassDescription>>updateTraits (in category '*Traits-NanoKernel') ----- >updateTraits >"Recompute my local traits composition" >+ CurrentReadOnlySourceFiles cacheDuring: [ >+ self installTraitsFrom: self traitComposition]! >- self installTraitsFrom: self traitComposition. >- ! > >Item was changed: >----- Method: TraitDescription>>addSelectorSilently:withMethod: (in category 'operations') ----- >addSelectorSilently: selector withMethod: compiledMethod >"Overridden to update the users of this trait" >+ CurrentReadOnlySourceFiles cacheDuring: [ >+ super addSelectorSilently: selector withMethod: compiledMethod. >+ self users do:[:each| each updateTraits]]! >- super addSelectorSilently: selector withMethod: compiledMethod. >- self users do:[:each| each updateTraits].! > > >------=_NextPart_60499218.255784114046-- |
Free forum by Nabble | Edit this page |