<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        Hi Dave,<div><br></div><div>yes, that's an important tweak.</div><div><br></div><div>I was wondering about this:</div><div><br></div><div>...</div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">elapsedTime := Time millisecondsSince: startTime.</span><br style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">gcTime := (Smalltalk vmParameterAt: 8) + (Smalltalk vmParameterAt: 10) - gcStart.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">...</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">How complex is #millisecondsSince:? Would it make sense to swap those lines? Given that #bench usually runs for 5 seconds and the GC time is expressed in %, this might be irrelevant... </span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Best,</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Marcel</span></div><div class="mb_sig"></div><blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 02.11.2019 16:15:53 schrieb David T. Lewis <lewis@mail.msen.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">+1 for inclusion, with the following suggested tweak:<br><br>Use printShowingMaxDecimalPlaces: rather than roundTo: in the percent<br>GC display, and also drop the space before the $%. Thus the last line<br>of the method would be:<br><br><br>  pair second } ]), (' {1}% GC time.' format: {gcTime / elapsedTime * 100 printShowingMaxDecimalPlaces: 5})<br><br><br>Rationale: Rounding may not do what you expect with some float calculations.<br>This may be VM dependent (I can explain in a separate follow up message),<br>but for example I saw occasional results like this:<br><br> '85,200 per second. 11.7 microseconds per run. 2.3850000000000002 % GC time.'<br><br>Using printShowingMaxDecimalPlaces: will ensure this instead:<br><br> '85,200 per second. 11.7 microseconds per run. 2.385% GC time.'<br><br>Dave<br><br><br>On Wed, Oct 30, 2019 at 11:13:41AM +0100, Tobias Pape wrote:<br>> We probably should introduce something like that<br>> <br>> <br>> gcTimings<br>> <br>>       ^ (Smalltalk getVMParameters at: 8 "full") + <br>>           (Smalltalk getVMParameters at: 10 "incr")<br>> <br>> <br>> Best regards<br>>      -Tobias<br>> > On 30.10.2019, at 10:27, Marcel Taeumel <marcel.taeumel@hpi.de> wrote:<br>> > <br>> > [Error] bench<br>> >    '217,000,000 per second. 4.62 nanoseconds per run. 0.16 % GC time.'<br>> > [Error, Halt] bench<br>> >    '10,400,000 per second. 96.5 nanoseconds per run. 6.2 % GC time.'<br>> > [Error, Halt, Warning] bench<br>> >    '9,800,000 per second. 102 nanoseconds per run. 7.78 % GC time.'<br>> > <br>> > Best,<br>> > Marcel<br>> >> Am 30.10.2019 10:25:21 schrieb commits@source.squeak.org <commits@source.squeak.org>:<br>> >> <br>> >> A new version of Chronology-Core was added to project The Inbox:<br>> >> http://source.squeak.org/inbox/Chronology-Core-mt.50.mcz<br>> >> <br>> >> ==================== Summary ====================<br>> >> <br>> >> Name: Chronology-Core-mt.50<br>> >> Author: mt<br>> >> Time: 30 October 2019, 10:25:14.294226 am<br>> >> UUID: f064aadc-0e62-174e-b97c-f70cc22a23f6<br>> >> Ancestors: Chronology-Core-mt.49<br>> >> <br>> >> Proposal to add GC pressure to #bench method.<br>> >> <br>> >> =============== Diff against Chronology-Core-mt.49 ===============<br>> >> <br>> >> Item was changed:<br>> >> ----- Method: BlockClosure>>benchFor: (in category '*chronology-core') -----<br>> >> benchFor: aDuration<br>> >> "See how many times I can value within the given duration. I'll answer a meaningful description."<br>> >> <br>> >> + | startTime shouldRun count elapsedTime roundTo3Digits delay gcStart gcTime |<br>> >> - | startTime shouldRun count elapsedTime roundTo3Digits delay |<br>> >> roundTo3Digits := [:num |<br>> >> | rounded lowDigit |<br>> >> rounded := (num * 1000) rounded. "round to 1/1000"<br>> >> lowDigit := (rounded numberOfDigitsInBase: 10) - 3. "keep only first 3 digits"<br>> >> rounded := rounded roundTo:(10 raisedTo: lowDigit).<br>> >> (lowDigit >= 3 or: [rounded \\ 1000 = 0]) "display fractional part only when needed"<br>> >> ifTrue: [(rounded // 1000) asStringWithCommas]<br>> >> ifFalse: [(rounded / 1000.0) printString]].<br>> >> delay := aDuration asDelay.<br>> >> count := 0.<br>> >> shouldRun := true.<br>> >> + Smalltalk garbageCollect.<br>> >> [ delay wait. shouldRun := false ] forkAt: Processor timingPriority - 1.<br>> >> startTime := Time millisecondClockValue.<br>> >> + gcStart := (Smalltalk vmParameterAt: 8) + (Smalltalk vmParameterAt: 10).<br>> >> [ shouldRun ] whileTrue: [ <br>> >> self value.<br>> >> count := count + 1 ].<br>> >> elapsedTime := Time millisecondsSince: startTime.<br>> >> + gcTime := (Smalltalk vmParameterAt: 8) + (Smalltalk vmParameterAt: 10) - gcStart.<br>> >> ^(roundTo3Digits value: count * 1000 / elapsedTime) , ' per second.', ((<br>> >> #(<br>> >> (1e-3 'seconds')<br>> >> (1 'milliseconds')<br>> >> (1e3 'microseconds')<br>> >> (1e6 'nanoseconds')<br>> >> )<br>> >> detect: [ :pair | elapsedTime * pair first >= count ]<br>> >> ifNone: [ #(1e9 'picoseconds') ])<br>> >> in: [ :pair |<br>> >> ' {1} {2} per run.' format: {<br>> >> (roundTo3Digits value: elapsedTime * pair first / count).<br>> >> + pair second } ]), (' {1} % GC time.' format: {gcTime / elapsedTime * 100 roundTo: 0.0001})!<br>> >> - pair second } ])!<br>> >> <br>> >> <br>> > <br>> <br>> <br>> <br><br></commits@source.squeak.org></marcel.taeumel@hpi.de></div></blockquote>
                                        </div></body>