<div dir="ltr"><div dir="ltr">On Sun, Jan 3, 2021 at 8:11 AM David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, Jan 02, 2021 at 02:56:49PM -0500, David T. Lewis wrote:<br>
> Hi Eliot,<br>
> <br>
> On Sat, Jan 02, 2021 at 11:10:45AM -0800, Eliot Miranda wrote:<br>
> > <br>
> > <br>
> > > On Jan 2, 2021, at 8:41 AM, David T. Lewis <<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>> wrote:<br>
> > > <br>
> > > ???Hi Vanessa,<br>
> > > <br>
> > >> On Fri, Jan 01, 2021 at 09:28:35PM -0800, Vanessa Freudenberg wrote:<br>
> > >> Hi Dave,<br>
> > >> <br>
> > >> I haven???t actually tried it but it seems on a slow platform this would<br>
> > >> delay the first-time startup by however long those benchmarks take, right?<br>
> > >> <br>
> > > <br>
> > > No, it would run at most one time per session, and then only if someone<br>
> > > sends #isLowerPerformance. I think thas means it would affect the run time<br>
> > > of the first unit test that someone runs after starting the image, but<br>
> > > otherwise no impact. Certainly it would not be noticable to humans.<br>
> > <br>
> > David, put this delay in every startup and use Squeak as a scripting<br>
> > language and apply the script to every file in your home directory and<br>
> > yes, it would be noticeable to humans.<br>
> > <br>
> <br>
> I does *not* do that. Apparently I am not doing a good job of explaining.<br>
> <br>
> <br>
<br>
Regarding startup time, I'm afraid that my explanation did not come across<br>
well in email, and I apologize for not being clear.<br>
<br>
Let me try once more by just quoting the code. At startup time, there is<br>
a new class var SlowPlatform that is set to nil. Otherwise nothing new<br>
is done during image startup processing:<br>
<br>
SmalltalkImage>>startUp: resuming<br>
        resuming ifTrue:<br>
                [LastStats := nil.<br>
                SlowPlatform := nil.<br>
                SystemChangeNotifier uniqueInstance notify: Smalltalk ofAllSystemChangesUsing: #event:]<br>
<br>
Later on, the class var is lazy initialized if and only if someone needs<br>
to check for isLowerPerformance:<br>
<br>
SmalltalkImage>>isLowerPerformance<br>
        "Some operations - TestCases for example - need an idea of the typical performance<br>
        of the system on which they are being performed."<br>
        ^ SlowPlatform<br>
                ifNil: [ SlowPlatform := (Time millisecondsToRun:[ 25 benchFib ]) > 200<br>
                        or: [ (Time millisecondsToRun: [ 64 benchmark ]) > 200 ]]<br>
<br>
That's all I meant to suggest.<br>
<br>
Sorry for the confusion,<br>
<br>
Dave<br></blockquote><div><br></div><div>Hi Dave, </div><div><br></div><div>you are correct for someone who prepares an image that they use over and over again.</div><div><br></div><div>However, for someone using a fresh image that was just created using ReleaseBuilder, there will be a isLowerPerformance send on startup (via ReleaseBuilder class>>startUp: with a DeferredTask set by prepareEnvironment to open the PreferenceWizardMorph which uses its own hasLowPerformance method to try to make things faster).</div><div><br></div><div>Compare this 5.3 image with disabled wizard:</div><div><br></div><div><a href="https://squeak.js.org/run/#url=https://freudenbergs.de/vanessa/squeakjs&zip=[Squeak5.3-19452-64bit.zip,SqueakV50.sources.zip]&wizard=false">https://squeak.js.org/run/#url=https://freudenbergs.de/vanessa/squeakjs&zip=[Squeak5.3-19452-64bit.zip,SqueakV50.sources.zip]&wizard=false</a><br></div><div><br></div><div>to the latest trunk (very slow because Sista so no JIT):</div><div><br></div><div><a href="https://squeak.js.org/run/#zip=https://files.squeak.org/6.0alpha/Squeak6.0alpha-20147-32bit/Squeak6.0alpha-20147-32bit.zip">https://squeak.js.org/run/#zip=https://files.squeak.org/6.0alpha/Squeak6.0alpha-20147-32bit/Squeak6.0alpha-20147-32bit.zip</a><br></div><div><br></div><div>and that even has isLowerPerformance = true because we did fix the platform name check!</div><div><br></div><div>If it was using your code then the "Time millisecondsToRun:[ 25 benchFib ]" would add 600 ms to the startup. Luckily it would bypass the "Time millisecondsToRun: [ 64 benchmark ]" which would take 4 seconds.</div><div><br></div><div>So I'm in favor of Levente's idea, he proposed this:</div><div><br></div><div>| vmStartTime uptime |<br>vmStartTime := Smalltalk vmParameterAt: 20.<br>uptime := vmStartTime ~= 0 "utcMicrosecondClock at startup in later Spur VMs"<br>        ifTrue: [Time utcMicrosecondClock - vmStartTime + 500 // 1000]<br>        ifFalse: [Time eventMillisecondClock].<br></div><div><br></div><div>... which works in SqueakJS because of the eventMillisecondClock fallback (vmParameter 20 is 0).</div><div><br></div><div>We just would have to decide where in the startup sequence to put this check, which is slightly tricky. An obvious place would be in #recordStartupStamp - I just tried it:</div><div><br></div><div>recordStartupStamp<br>               | vmStartTime |<br>            vmStartTime := Smalltalk vmParameterAt: 20.<br>        StartupTime := vmStartTime ~= 0 "utcMicrosecondClock at startup in later Spur VMs"<br><div>             ifTrue: [Time utcMicrosecondClock - vmStartTime + 500 // 1000]<br>              ifFalse: [Time eventMillisecondClock].<br></div><div></div>       StartupStamp := '----STARTUP----', Time dateAndTimeNow printString, ' as ', self imageName.<br></div><div><br></div><div>... and StartupTime is about 3000 ms. Then isLowerPerformance would become</div><div><br></div><div>      ^StartupTime > LowerPerformanceThreshold<br></div><div><br></div><div>where LowerPerformanceThreshold would maybe default to 500? What's the StartupTime of e.g. a raspberry pi? </div><div><br></div><div>Vanessa</div><div><br></div></div></div>