<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">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<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;">
<p>Hi Eliot, these are interesting ideas! :-)</p>
<p><br>
</p>
<p>Your pattern is cool, it reminds me a little bit of the approach we are using for Shout, see SHTextStyler >> #styleInBackgroundProcess:.</p>
<p>It even more reminds me of Collection >> #<span>do:displayingProgress:every:.</span></p>
<p><span>And last but not least, at a fundamental level</span><span style="font-size:12pt">, aren't we replicating the usual stepping logic from WorldState here?</span></p>
<p><span></span></p>
<p><span><br>
</span></p>
<p><span style="font-size: 12pt;">In your approach, where do you process the scheduled messages? The problem is that we are running the simulation/execution code on the UI process. See this thread, too: </span><a href="http://forum.world.st/Debugging-of-other-processes-with-wait-tp5119965p5120049.html" class="OWAAutoLink" id="LPlnk798194" previewremoved="true" style="font-size: 12pt;">http://forum.world.st/Debugging-of-other-processes-with-wait-tp5119965p5120049.html</a><br>
</p>
<p><br>
</p>
<p>I would not use #<span>lastDeferredUIMessage unless we can rule out that any other client is communicating with the WorldState. Which we, afaik, never can rule out since the idea of the deferred messages is that you can have them scheduled from any background
 process.</span></p>
<br>
<p></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
It would be cool to develop some reusable logic that is applicable to different domains without expensive adaption. Maybe we should just add some static generic helper method for this?</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
Best,
<p></p>
<p>Christoph</p>
<p><br>
</p>
<p><span></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>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Eliot Miranda <eliot.miranda@gmail.com><br>
<b>Gesendet:</b> Samstag, 19. September 2020 21:36:57<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Betreff:</b> Re: [squeak-dev] Can we make computing the local variables in the debugger lazy?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_default" style="font-size:large">Hi Christoph,</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sat, Sep 19, 2020 at 11:57 AM Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div>
<div id="gmail-m_-2642007291881837946divtagdefaultwrapper" 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;">
<p>Hi Eliot,</p>
<p><br>
</p>
<p>very nice finding once again! I #timeProfile'd the menu button action and as I expected, the most expensive operation is the shout styling by the new inspectors, including the decompilation of every method:</p>
<p><br>
</p>
<p><img naturalheight="731" naturalwidth="1521" size="399308" id="gmail-m_-2642007291881837946img727041" style="max-width: 99.9%; user-select: none;" src="cid:174a7d2f503f456b1e51"><br>
</p>
<div id="gmail-m_-2642007291881837946Signature">
<div id="gmail-m_-2642007291881837946divtagdefaultwrapper" 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">
<div>
<div id="gmail-m_-2642007291881837946Item.MessagePartBody">
<div id="gmail-m_-2642007291881837946Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="gmail-m_-2642007291881837946divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="gmail-m_-2642007291881837946Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont">
<div><font size="3" color="black"><span style="font-size:12pt"><a href="http://www.hpi.de/" rel="noopener noreferrer" id="gmail-m_-2642007291881837946LPNoLP" target="_blank"><font size="2"><span id="gmail-m_-2642007291881837946LPlnk909538"><font color="#757B80"></font></span></font></a></span></font></div>
</font></div>
</div>
</font></div>
</div>
</div>
</div>
<div id="gmail-m_-2642007291881837946Item.MessagePartBody"><br>
</div>
<div id="gmail-m_-2642007291881837946Item.MessagePartBody">First, when loading <span>ShoutCore-ct.78 (Inbox), the speed doubles (but probably that's rather a problem with my sources file, see the thread about this commit).</span></div>
<div id="gmail-m_-2642007291881837946Item.MessagePartBody"><span><br>
</span></div>
<div id="gmail-m_-2642007291881837946Item.MessagePartBody">Second, we do not redraw the world while running to the selection, so we do not need to update the inspectors at all. I think we could split up #doStep into some #basicDoStep (which would perform the
 actual stepping logic) + some #updateContextDuring: (which would update the stack list and the inspectors), then we would need to trigger the updates only once from #runToSelection:.</div>
<div id="gmail-m_-2642007291881837946Item.MessagePartBody">As an alternative, we could make this method a bit more complex but responsive by applying the same updating logic from #runUntil.</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div class="gmail_default"><font size="4">Nice.  What ever is TSTTCPW :-).  But it strikes me that one way is to use addDeferredUIMessage:.  The only tricky thing is not creating lots of these unnecessarily.  But that could be done by checking if the deferred
 action queue is empty or not.  E.g.  rewrite this in doStep:</font></div>
<div class="gmail_default"><font size="4"><br>
</font></div>
<div class="gmail_default">
<div class="gmail_default"><font size="4"><span class="gmail-Apple-tab-span" style="white-space:pre"></span><font face="times new roman, serif">self contextStackIndex > 1</font></font></div>
<div class="gmail_default"><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>ifTrue: [self resetContext: newContext]</font></div>
<div class="gmail_default"><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>ifFalse:</font></div>
<div class="gmail_default"><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>[newContext == currentContext</font></div>
<div class="gmail_default"><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>ifTrue: [self changed: #contentsSelection.</font></div>
<div class="gmail_default"><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>self updateInspectors]</font></div>
<div class="gmail_default"><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>ifFalse: [self resetContext: newContext]].</font></div>
<div><font size="4"><br>
</font></div>
<div><font size="4">as, say, </font></div>
<div><font size="4"><br>
</font></div>
<div>
<div><font size="4"><span class="gmail-Apple-tab-span" style="white-space:pre"></span><font face="times new roman, serif">self contextStackIndex > 1</font></font></div>
<div><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>ifTrue: [self resetContext: newContext]</font></div>
<div><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>ifFalse:</font></div>
<div><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>[newContext == currentContext</font></div>
<div><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>ifTrue: [self scheduleUIUpdate]</font></div>
<div><font size="4" face="times new roman, serif"><span class="gmail-Apple-tab-span" style="white-space:pre"></span>ifFalse: [self resetContext: newContext]].</font></div>
</div>
<div><font size="4"><br>
</font></div>
<div><font size="4">add an inst var to hold the last deferred action, and then do something like</font></div>
<div><font size="4"><br>
</font></div>
<div><font size="4" face="times new roman, serif">Debugger>><span style="color:rgb(0,0,0)">scheduleUIUpdate</span></font></div>
<div><span style="color:rgb(0,0,0)"><font size="4" face="times new roman, serif">    (lastScheduledUpdate notNil</font></span></div>
<div><font size="4" face="times new roman, serif"><span style="color:rgb(0,0,0)">    and: [</span>WorldState lastDeferredUIMessage == <span style="color:rgb(0,0,0)">lastScheduledUpdate]) ifTrue:</span></font></div>
<div><span style="color:rgb(0,0,0)"><font size="4" face="times new roman, serif">        [^self].</font></span></div>
<div><font size="4" face="times new roman, serif"><span style="color:rgb(0,0,0)">   
</span><span style="color:rgb(0,0,0)">lastScheduledUpdate := </span><span style="color:rgb(0,0,0)">[</span><span style="color:rgb(0,0,0)">self changed: #contentsSelection. </span><span style="color:rgb(0,0,0)">self updateInspectors].</span></font></div>
<div><font size="4" face="times new roman, serif"><span style="color:rgb(0,0,0)">    WorldState addDeferredUIMessage: </span></font><span style="color:rgb(0,0,0); font-size:medium">lastScheduledUpdate</span></div>
<div><span style="color:rgb(0,0,0)"><font size="4"><br>
</font></span></div>
<div><font size="4" face="arial, sans-serif"><span style="color:rgb(0,0,0)">For this we have to add the </span><span style="color:rgb(0,0,0)">lastDeferredUIMessage accessor to all the relevant places, but it seems a nice pattern to me.</span></font></div>
<div><font size="4" face="arial, sans-serif"><span style="color:rgb(0,0,0)"><br>
</span></font></div>
<div><font face="arial, sans-serif" size="4"><span style="color:rgb(0,0,0)">And of course, there is no need to refresh </span><span style="color:rgb(0,0,0)">lastScheduledUpdate.  It could be </span></font></div>
<div><font size="4"><br>
</font></div>
<div>
<div style="color:rgb(0,0,0)"><font size="4" face="times new roman, serif">Debugger>>scheduleUIUpdate</font></div>
<div style="color:rgb(0,0,0)"><font face="times new roman, serif"><font size="4">    lastScheduledUpdate ifNil: [</font><span style="font-size:medium">lastScheduledUpdate := [self changed: #contentsSelection. self updateInspectors]].</span></font></div>
<div style="color:rgb(0,0,0)"><font size="4" face="times new roman, serif">    WorldState lastDeferredUIMessage ~~ lastScheduledUpdate ifTrue:</font></div>
<div style="color:rgb(0,0,0)"><font face="times new roman, serif"><font size="4">        [</font><font size="4">WorldState addDeferredUIMessage: </font><span style="font-size:medium">lastScheduledUpdate]</span></font></div>
</div>
<div><font size="4"><br>
</font></div>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div id="gmail-m_-2642007291881837946divtagdefaultwrapper" dir="ltr" style="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 id="gmail-m_-2642007291881837946Signature">
<div id="gmail-m_-2642007291881837946divtagdefaultwrapper" dir="ltr" style="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">
<div id="gmail-m_-2642007291881837946Item.MessagePartBody"><font size="4">What do you think? :-)<br>
</font></div>
</div>
</div>
</div>
</div>
</blockquote>
<div><font size="4"><br>
</font></div>
<div class="gmail_default"><font size="4">What do you like?</font></div>
<div class="gmail_default"><font size="4"></font></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div>
<div id="gmail-m_-2642007291881837946divtagdefaultwrapper" dir="ltr" style="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 id="gmail-m_-2642007291881837946Signature">
<div id="gmail-m_-2642007291881837946divtagdefaultwrapper" dir="ltr" style="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">
<div>
<div id="gmail-m_-2642007291881837946Item.MessagePartBody"><span style="font-size:large">Best,</span><br>
</div>
<div id="gmail-m_-2642007291881837946Item.MessagePartBody"><font size="4">Christoph</font></div>
</div>
<div><font color="#808080" size="4"></font></div>
</div>
</div>
</div>
</div>
<font size="4">
<hr style="display:inline-block; width:98%">
</font>
<div id="gmail-m_-2642007291881837946divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000"><font size="4"><b>Von:</b> Squeak-dev <</font><a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank"><font size="4">squeak-dev-bounces@l</font><span style="font-size:11pt">ists.squeakfoundation.org</span></a><span style="font-size:11pt">>
 im Auftrag von Eliot Miranda <</span><a href="mailto:eliot.miranda@gmail.com" target="_blank" style="font-size:11pt">eliot.miranda@gmail.com</a><span style="font-size:11pt">></span><br>
<b style="font-size:11pt">Gesendet:</b><span style="font-size:11pt"> Samstag, 19. September 2020 20:17:12</span><br>
<b style="font-size:11pt">An:</b><span style="font-size:11pt"> The general-purpose Squeak developers list; Taeumel, Marcel</span><br>
<b style="font-size:11pt">Betreff:</b><span style="font-size:11pt"> [squeak-dev] Can we make computing the local variables in the debugger lazy?</span></font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, sans-serif" size="4">Hi Marcel,</font></div>
<div><font face="arial, sans-serif" size="4"><br>
</font></div>
<div><font face="arial, sans-serif" size="4">    can we try and reduce the frequency at which we compute the variables in the context inspector in the debugger?  It is a noticeable performance hit.  I really like the user interface, but the performance hit
 is making debugging difficult.</font></div>
<div><font face="arial, sans-serif" size="4"><br>
</font></div>
<div><font face="arial, sans-serif" size="4">As an example use this:</font></div>
<div><font face="arial, sans-serif" size="4"><br>
</font></div>
<div>
<div><font size="4" face="times new roman, serif">| samples sineTable sound |</font></div>
<div><font size="4" face="times new roman, serif">"1 second of A below middle C (220Hz). 16000 / 220 is 72.72 recurring"</font></div>
<div><font size="4" face="times new roman, serif">sineTable := SoundPlayer sineTable: 73.</font></div>
<div><font size="4" face="times new roman, serif">sineTable doWithIndex: "And let's not deafen anyone..."</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>[:sample :index| sineTable at: index put: sample // 4].</font></div>
<div><font size="4" face="times new roman, serif">samples := SoundBuffer new: 16000.</font></div>
<div><font size="4" face="times new roman, serif">1 to: samples size by: sineTable size do:</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>[:i| samples replaceFrom: i to: (i + sineTable size - 1 min: 16000) with: sineTable startingAt: 1].</font></div>
<div><font size="4" face="times new roman, serif">1 to: 146 do:</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>[:i|</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>samples at: i put: ((samples at: i) * i / 146) asInteger.</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>samples at: 16001 - i put: ((samples at: 16001 - i) * i / 146) asInteger].</font></div>
<div><font size="4" face="times new roman, serif">sound := SampledSound</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>samples: samples</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>samplingRate: 16000.</font></div>
<div><font size="4" face="times new roman, serif">sound := MixedSound new</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>add: sound pan: 0.25;</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>add: sound pan: 0.75;</font></div>
<div><font size="4" face="times new roman, serif"><span style="white-space:pre-wrap"></span>yourself.</font></div>
<div><font size="4" face="times new roman, serif">sound computeSamplesForSeconds: sound duration</font></div>
<div><font face="arial, sans-serif" size="4"><br>
</font></div>
<div><font face="arial, sans-serif" size="4"><br>
</font></div>
<div><font face="arial, sans-serif" size="4">Open a workspace in e.g. a 64-bit image prior to Tools-mt.965 (I used an image containing Tools-mt.942).  Debug the above in the workspace.  Position the cursor at "<span style="color:rgb(0,0,0)">sound computeSamplesForSeconds:
 sound duration" and do "run to here".  It is essentially instantaneous.</span></font></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif" size="4"><br>
</font></span></div>
<div><font color="#000000" face="arial, sans-serif" size="4"><span>Now do the same in a contemporary trunk image.  It takes almost 6 seconds.</span></font></div>
<div><font color="#000000" face="arial, sans-serif" size="4"><span><br>
</span></font></div>
<div><font color="#000000" face="arial, sans-serif" size="4"><span>I used to be able to click step as fast as I could and the system would keep up with me.  Now I find that if I click too fast I can accumulate excess clicks and when I stp clicking the system
 will continue stepping and go too far.</span></font></div>
<div><font color="#000000" face="arial, sans-serif" size="4"><span><br>
</span></font></div>
<div><font color="#000000" face="arial, sans-serif" size="4"><span>I don't want to lose the feedback the new variables list gives us.  But I do find the performance hit tedious.  I wonder could we cache the list and only update it</span></font></div>
<div><font color="#000000" face="arial, sans-serif" size="4"><span>- when Morphic updates, and</span></font></div>
<div><font color="#000000" face="arial, sans-serif" size="4"><span>- when the context changes?</span></font></div>
<div><font color="#000000" face="arial, sans-serif" size="4"><span><br>
</span></font></div>
<div><span style="color:rgb(0,0,0)"><font face="arial, sans-serif" size="4"><br>
</font></span></div>
</div>
<div dir="ltr">
<div dir="ltr">
<div><span style="border-collapse:separate"><font face="arial, sans-serif" size="4">
<div>_,,,^..^,,,_<br>
</div>
<div>best, Eliot</div>
</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div><span style="font-size:small; border-collapse:separate">
<div>_,,,^..^,,,_<br>
</div>
<div>best, Eliot</div>
</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>