<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>> <span>Now I wonder whether it is really so simple.</span></p>
<p><span><br>
</span></p>
<p><span>Hm ... Not, it seems not, unfortunately. With the described change, my 2nd source file gets a nil fileID from time to time. Apparently, #<span>changeRecordsForMethod:do:</span> has some side weird effects on the sources file that cannot be prevented
 by resetting the file positions in an ensure block. :(</span></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Thiede, Christoph<br>
<b>Gesendet:</b> Donnerstag, 6. Januar 2022 22:28:51<br>
<b>An:</b> Squeak Dev<br>
<b>Betreff:</b> Proper use of SourceFiles and "CurrentReadOnlySourceFiles cacheDuring:"</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi all!</p>
<p><br>
</p>
<p>While investigating why Squot is so slow in my image, I found out that the following takes ~7 seconds in my image:</p>
<p><br>
</p>
<p></p>
<div>package := PackageInfo named: 'Tools'.</div>
<div>[package overriddenMethods] timeToRun.</div>
<br>
<p></p>
<p>According to the profiler, 48% of the time are spent in <span>StandardFileStream>>#unregister and 33% in <span>StandardFileStream>>#open:forWrite:.</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>By rewriting <span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">PackageInfo>>#changeRecordsForMethod:do:
 to use CurrentReadOnlySourceFiles rather than SourceFiles and wrapping the above invocation with "<span>CurrentReadOnlySourceFiles cacheDuring:", I was able to reduce the run time of my script to ~1.5 seconds.</span></span></span></span></p>
<p><span><span><span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span><br>
</span></span></span></span></p>
<p><span><span><span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span>Now I wonder whether it is really so simple. </span></span></span></span><span style="font-size: 12pt;">Do
 I understand the class comment of </span><span style="font-size: 12pt;">CurrentReadOnlySourceFiles correctly that </span><span style="font-size: 12pt;">i</span><span style="font-size: 12pt;">t is best practice to *always* use this fancy exception for any regular access
 to the source files? If yes, why are we having </span><span style="font-size: 12pt;">so few senders to </span><span style="font-size: 12pt;">CurrentReadOnlySourceFiles class >> #at: and so many senders to SourceFiles? Are we having a huge chance to optimize
 the image by rewriting all these senders? If you think this a good idea, I will be glad to do so! :-)</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">And here's another question: Why do we need to close the sources file again and again at all. Whenever you navigate within any browsing tool (a very popular workload for some people here, I think), they are basically opened
 and closed upon every click, aren't they? Why can't we keep them open all the time? Is this to avoid data loss, or would it decelerate the operating system? Thanks in advance!</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">Best,</span></p>
<p><span style="font-size: 12pt;">Christoph</span></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>