<div dir="ltr">Hi guys, <div><br></div><div>This looks like a lot of thought went into making an output that we want to be both functional as well as easy to read.<br><div><br></div><div>On a similar topic, has anyone else been finding #asBytesDescription to be similarly useful for reporting integral quantities, when the top three orders of precision are enough? What I like about it is how it lets me express any integer all the way up to (2 raisedTo: 99) in no more than *four* characters. See?</div><div><br></div><div> 9999 asBytesDescription "10k"</div><div> (2 raisedTo: 99) asBytesDescription " '634Y' <--- Yotta's" <br></div><div><br></div><div>This is a wonderfully dense representation, but I think extends even beyond "bytes descriptions" -- I think we need a better name for it... Is there a proper academic name for this representation?</div><div><br></div><div> - Chris</div><div></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 11, 2019 at 4:40 AM <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">A new version of Chronology-Core was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Chronology-Core-mt.51.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Chronology-Core-mt.51.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Chronology-Core-mt.51<br>
Author: mt<br>
Time: 11 November 2019, 11:40:16.217633 am<br>
UUID: 199ad2ea-67cb-2545-84e9-4f24e577216f<br>
Ancestors: Chronology-Core-mt.50<br>
<br>
Improve formatting for GC pressure as suggested by Dave.<br>
<br>
=============== Diff against Chronology-Core-mt.50 ===============<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>
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 printShowingMaxDecimalPlaces: 5})!<br>
- pair second } ]), (' {1} % GC time.' format: {gcTime / elapsedTime * 100 roundTo: 0.0001})!<br>
<br>
<br>
</blockquote></div>