Bert Freudenberg uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-bf.730.mcz ==================== Summary ==================== Name: Kernel-bf.730 Author: bf Time: 11 January 2013, 12:10:54.539 pm UUID: 287d829c-b04d-4165-abc5-e045d037bd6d Ancestors: Kernel-nice.729 Cache source files during class mutation for noticeable speedup with larger hierarchies. =============== Diff against Kernel-nice.729 =============== Item was changed: ----- Method: ClassBuilder>>recompile:from:to:mutate: (in category 'class definition') ----- recompile: force from: oldClass to: newClass mutate: forceMutation "Do the necessary recompilation after changine oldClass to newClass. If required (e.g., when oldClass ~~ newClass) mutate oldClass to newClass and all its subclasses. If forceMutation is true force a mutation even if oldClass and newClass are the same." oldClass == nil ifTrue:[^ newClass]. (newClass == oldClass and:[force not and:[forceMutation not]]) ifTrue:[ ^newClass]. currentClassIndex := 0. maxClassIndex := oldClass withAllSubclasses size. (oldClass == newClass and:[forceMutation not]) ifTrue:[ "Recompile from newClass without mutating" self informUserDuring:[ newClass isSystemDefined ifFalse:[progress := nil]. + CurrentReadOnlySourceFiles cacheDuring: [ + newClass withAllSubclassesDo:[:cl| + self showProgressFor: cl. + cl compileAll]]]. - newClass withAllSubclassesDo:[:cl| - self showProgressFor: cl. - cl compileAll]]. ^newClass]. "Recompile and mutate oldClass to newClass" self informUserDuring:[ newClass isSystemDefined ifFalse:[progress := nil]. + CurrentReadOnlySourceFiles cacheDuring: [ + self mutate: oldClass to: newClass]. - self mutate: oldClass to: newClass. ]. ^oldClass "now mutated to newClass"! |
Having to spread these cacheDuring: all around client code does not
sound bright to my personal taste... Nicolas 2013/1/11 <[hidden email]>: > Bert Freudenberg uploaded a new version of Kernel to project The Trunk: > http://source.squeak.org/trunk/Kernel-bf.730.mcz > > ==================== Summary ==================== > > Name: Kernel-bf.730 > Author: bf > Time: 11 January 2013, 12:10:54.539 pm > UUID: 287d829c-b04d-4165-abc5-e045d037bd6d > Ancestors: Kernel-nice.729 > > Cache source files during class mutation for noticeable speedup with larger hierarchies. > > =============== Diff against Kernel-nice.729 =============== > > Item was changed: > ----- Method: ClassBuilder>>recompile:from:to:mutate: (in category 'class definition') ----- > recompile: force from: oldClass to: newClass mutate: forceMutation > "Do the necessary recompilation after changine oldClass to newClass. > If required (e.g., when oldClass ~~ newClass) mutate oldClass to newClass > and all its subclasses. If forceMutation is true force a mutation even > if oldClass and newClass are the same." > > oldClass == nil ifTrue:[^ newClass]. > > (newClass == oldClass and:[force not and:[forceMutation not]]) ifTrue:[ > ^newClass]. > > currentClassIndex := 0. > maxClassIndex := oldClass withAllSubclasses size. > > (oldClass == newClass and:[forceMutation not]) ifTrue:[ > "Recompile from newClass without mutating" > self informUserDuring:[ > newClass isSystemDefined ifFalse:[progress := nil]. > + CurrentReadOnlySourceFiles cacheDuring: [ > + newClass withAllSubclassesDo:[:cl| > + self showProgressFor: cl. > + cl compileAll]]]. > - newClass withAllSubclassesDo:[:cl| > - self showProgressFor: cl. > - cl compileAll]]. > ^newClass]. > "Recompile and mutate oldClass to newClass" > self informUserDuring:[ > newClass isSystemDefined ifFalse:[progress := nil]. > + CurrentReadOnlySourceFiles cacheDuring: [ > + self mutate: oldClass to: newClass]. > - self mutate: oldClass to: newClass. > ]. > ^oldClass "now mutated to newClass"! > > |
On 11.01.2013, at 12:37, Nicolas Cellier <[hidden email]> wrote: > Having to spread these cacheDuring: all around client code does not > sound bright to my personal taste... > > Nicolas Agreed, but it's all we have for now. Got a better idea? - Bert - > > 2013/1/11 <[hidden email]>: >> Bert Freudenberg uploaded a new version of Kernel to project The Trunk: >> http://source.squeak.org/trunk/Kernel-bf.730.mcz >> >> ==================== Summary ==================== >> >> Name: Kernel-bf.730 >> Author: bf >> Time: 11 January 2013, 12:10:54.539 pm >> UUID: 287d829c-b04d-4165-abc5-e045d037bd6d >> Ancestors: Kernel-nice.729 >> >> Cache source files during class mutation for noticeable speedup with larger hierarchies. >> >> =============== Diff against Kernel-nice.729 =============== >> >> Item was changed: >> ----- Method: ClassBuilder>>recompile:from:to:mutate: (in category 'class definition') ----- >> recompile: force from: oldClass to: newClass mutate: forceMutation >> "Do the necessary recompilation after changine oldClass to newClass. >> If required (e.g., when oldClass ~~ newClass) mutate oldClass to newClass >> and all its subclasses. If forceMutation is true force a mutation even >> if oldClass and newClass are the same." >> >> oldClass == nil ifTrue:[^ newClass]. >> >> (newClass == oldClass and:[force not and:[forceMutation not]]) ifTrue:[ >> ^newClass]. >> >> currentClassIndex := 0. >> maxClassIndex := oldClass withAllSubclasses size. >> >> (oldClass == newClass and:[forceMutation not]) ifTrue:[ >> "Recompile from newClass without mutating" >> self informUserDuring:[ >> newClass isSystemDefined ifFalse:[progress := nil]. >> + CurrentReadOnlySourceFiles cacheDuring: [ >> + newClass withAllSubclassesDo:[:cl| >> + self showProgressFor: cl. >> + cl compileAll]]]. >> - newClass withAllSubclassesDo:[:cl| >> - self showProgressFor: cl. >> - cl compileAll]]. >> ^newClass]. >> "Recompile and mutate oldClass to newClass" >> self informUserDuring:[ >> newClass isSystemDefined ifFalse:[progress := nil]. >> + CurrentReadOnlySourceFiles cacheDuring: [ >> + self mutate: oldClass to: newClass]. >> - self mutate: oldClass to: newClass. >> ]. >> ^oldClass "now mutated to newClass"! >> >> > |
2013/1/11 Bert Freudenberg <[hidden email]>:
> > On 11.01.2013, at 12:37, Nicolas Cellier <[hidden email]> wrote: > >> Having to spread these cacheDuring: all around client code does not >> sound bright to my personal taste... >> >> Nicolas > > Agreed, but it's all we have for now. Got a better idea? > > - Bert - > Nothing yet, It would be in the inbox ;) >> >> 2013/1/11 <[hidden email]>: >>> Bert Freudenberg uploaded a new version of Kernel to project The Trunk: >>> http://source.squeak.org/trunk/Kernel-bf.730.mcz >>> >>> ==================== Summary ==================== >>> >>> Name: Kernel-bf.730 >>> Author: bf >>> Time: 11 January 2013, 12:10:54.539 pm >>> UUID: 287d829c-b04d-4165-abc5-e045d037bd6d >>> Ancestors: Kernel-nice.729 >>> >>> Cache source files during class mutation for noticeable speedup with larger hierarchies. >>> >>> =============== Diff against Kernel-nice.729 =============== >>> >>> Item was changed: >>> ----- Method: ClassBuilder>>recompile:from:to:mutate: (in category 'class definition') ----- >>> recompile: force from: oldClass to: newClass mutate: forceMutation >>> "Do the necessary recompilation after changine oldClass to newClass. >>> If required (e.g., when oldClass ~~ newClass) mutate oldClass to newClass >>> and all its subclasses. If forceMutation is true force a mutation even >>> if oldClass and newClass are the same." >>> >>> oldClass == nil ifTrue:[^ newClass]. >>> >>> (newClass == oldClass and:[force not and:[forceMutation not]]) ifTrue:[ >>> ^newClass]. >>> >>> currentClassIndex := 0. >>> maxClassIndex := oldClass withAllSubclasses size. >>> >>> (oldClass == newClass and:[forceMutation not]) ifTrue:[ >>> "Recompile from newClass without mutating" >>> self informUserDuring:[ >>> newClass isSystemDefined ifFalse:[progress := nil]. >>> + CurrentReadOnlySourceFiles cacheDuring: [ >>> + newClass withAllSubclassesDo:[:cl| >>> + self showProgressFor: cl. >>> + cl compileAll]]]. >>> - newClass withAllSubclassesDo:[:cl| >>> - self showProgressFor: cl. >>> - cl compileAll]]. >>> ^newClass]. >>> "Recompile and mutate oldClass to newClass" >>> self informUserDuring:[ >>> newClass isSystemDefined ifFalse:[progress := nil]. >>> + CurrentReadOnlySourceFiles cacheDuring: [ >>> + self mutate: oldClass to: newClass]. >>> - self mutate: oldClass to: newClass. >>> ]. >>> ^oldClass "now mutated to newClass"! >>> >>> >> > > |
In reply to this post by Bert Freudenberg
On Fri, Jan 11, 2013 at 1:27 PM, Bert Freudenberg <[hidden email]> wrote:
Yes. In an older Newspeak image I added readOnlyCopy: to SourceFilesArray so that SourceFIlesArray holds precisely one read-only copy of each source/changes file instead of creating new ones whenever needed (which can run out of file handles in error cases, as happened in a Newspeak image just yesterday). Then clients (essentially getSourceFromFile) that want to read the source use (SourceFilesArray readOnlyCopyAt: fileIndex). The read-only files are flushed at start-up. That completely replaces the (IMO rather clunky) CurrentReadOnlySourceFiles approach. If this sounds good I could integrate it into 4.4, except that I' prefer to shirk the effort and give the code to someone who'd review it/polish it.
best, Eliot
|
On 11-01-2013, at 1:56 PM, Eliot Miranda <[hidden email]> wrote: > > Yes. In an older Newspeak image I added readOnlyCopy: to SourceFilesArray so that SourceFIlesArray holds precisely one read-only copy of each source/changes file instead of creating new ones whenever needed (which can run out of file handles in error cases, as happened in a Newspeak image just yesterday). Then clients (essentially getSourceFromFile) that want to read the source use (SourceFilesArray readOnlyCopyAt: fileIndex). The read-only files are flushed at start-up. That completely replaces the (IMO rather clunky) CurrentReadOnlySourceFiles approach. If this sounds good I could integrate it into 4.4, except that I' prefer to shirk the effort and give the code to someone who'd review it/polish it. Is this the ancient and very annoying scenario where various source related files are opened many times for both read and read/write, sometimes by just copying the damn file pointer bytes? I had so many problems caused by that… Eventually I had to write an entire filing system for RISCOS to fake that out. The only reason the stupid idea was even needed was the plain broken file access policy of using - what is it called, 'streams' ? - that assume the file pointer hasn't been moved when writing. It could all go away by using an api like write(toFile, thisStuff, atThispoint, thisManyBytes) instead. tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Strange OpCodes: FCE: Fill Core with Epoxy |
Free forum by Nabble | Edit this page |