<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 1:27 PM, Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
<br>
On 11.01.2013, at 12:37, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br>
<br>
> Having to spread these cacheDuring: all around client code does not<br>
> sound bright to my personal taste...<br>
><br>
> Nicolas<br>
<br>
</div>Agreed, but it's all we have for now. Got a better idea?<br></blockquote><div><br></div><div>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) <span class="" style="font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)">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.</span></div>
<div><span class="" style="font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)"><br></span></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><font color="#888888"><br>
- Bert -<br>
</font></span><div class=""><div class="h5"><br>
><br>
> 2013/1/11 <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>>:<br>
>> Bert Freudenberg uploaded a new version of Kernel to project The Trunk:<br>
>> <a href="http://source.squeak.org/trunk/Kernel-bf.730.mcz" target="_blank">http://source.squeak.org/trunk/Kernel-bf.730.mcz</a><br>
>><br>
>> ==================== Summary ====================<br>
>><br>
>> Name: Kernel-bf.730<br>
>> Author: bf<br>
>> Time: 11 January 2013, 12:10:54.539 pm<br>
>> UUID: 287d829c-b04d-4165-abc5-e045d037bd6d<br>
>> Ancestors: Kernel-nice.729<br>
>><br>
>> Cache source files during class mutation for noticeable speedup with larger hierarchies.<br>
>><br>
>> =============== Diff against Kernel-nice.729 ===============<br>
>><br>
>> Item was changed:<br>
>> ----- Method: ClassBuilder>>recompile:from:to:mutate: (in category 'class definition') -----<br>
>> recompile: force from: oldClass to: newClass mutate: forceMutation<br>
>> "Do the necessary recompilation after changine oldClass to newClass.<br>
>> If required (e.g., when oldClass ~~ newClass) mutate oldClass to newClass<br>
>> and all its subclasses. If forceMutation is true force a mutation even<br>
>> if oldClass and newClass are the same."<br>
>><br>
>> oldClass == nil ifTrue:[^ newClass].<br>
>><br>
>> (newClass == oldClass and:[force not and:[forceMutation not]]) ifTrue:[<br>
>> ^newClass].<br>
>><br>
>> currentClassIndex := 0.<br>
>> maxClassIndex := oldClass withAllSubclasses size.<br>
>><br>
>> (oldClass == newClass and:[forceMutation not]) ifTrue:[<br>
>> "Recompile from newClass without mutating"<br>
>> self informUserDuring:[<br>
>> newClass isSystemDefined ifFalse:[progress := nil].<br>
>> + CurrentReadOnlySourceFiles cacheDuring: [<br>
>> + newClass withAllSubclassesDo:[:cl|<br>
>> + self showProgressFor: cl.<br>
>> + cl compileAll]]].<br>
>> - newClass withAllSubclassesDo:[:cl|<br>
>> - self showProgressFor: cl.<br>
>> - cl compileAll]].<br>
>> ^newClass].<br>
>> "Recompile and mutate oldClass to newClass"<br>
>> self informUserDuring:[<br>
>> newClass isSystemDefined ifFalse:[progress := nil].<br>
>> + CurrentReadOnlySourceFiles cacheDuring: [<br>
>> + self mutate: oldClass to: newClass].<br>
>> - self mutate: oldClass to: newClass.<br>
>> ].<br>
>> ^oldClass "now mutated to newClass"!<br>
>><br>
>><br>
><br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>