[squeak-dev] The Inbox: Chronology-Core-mt.50.mcz

Tobias Pape Das.Linux at gmx.de
Wed Oct 30 10:13:41 UTC 2019


We probably should introduce something like that


gcTimings

	^ (Smalltalk getVMParameters at: 8 "full") + 
		(Smalltalk getVMParameters at: 10 "incr")


Best regards
	-Tobias
> On 30.10.2019, at 10:27, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
> 
> [Error] bench
>    '217,000,000 per second. 4.62 nanoseconds per run. 0.16 % GC time.'
> [Error, Halt] bench
>    '10,400,000 per second. 96.5 nanoseconds per run. 6.2 % GC time.'
> [Error, Halt, Warning] bench
>    '9,800,000 per second. 102 nanoseconds per run. 7.78 % GC time.'
> 
> Best,
> Marcel
>> Am 30.10.2019 10:25:21 schrieb commits at source.squeak.org <commits at source.squeak.org>:
>> 
>> A new version of Chronology-Core was added to project The Inbox:
>> http://source.squeak.org/inbox/Chronology-Core-mt.50.mcz
>> 
>> ==================== Summary ====================
>> 
>> Name: Chronology-Core-mt.50
>> Author: mt
>> Time: 30 October 2019, 10:25:14.294226 am
>> UUID: f064aadc-0e62-174e-b97c-f70cc22a23f6
>> Ancestors: Chronology-Core-mt.49
>> 
>> Proposal to add GC pressure to #bench method.
>> 
>> =============== Diff against Chronology-Core-mt.49 ===============
>> 
>> Item was changed:
>> ----- Method: BlockClosure>>benchFor: (in category '*chronology-core') -----
>> benchFor: aDuration
>> "See how many times I can value within the given duration. I'll answer a meaningful description."
>> 
>> + | startTime shouldRun count elapsedTime roundTo3Digits delay gcStart gcTime |
>> - | startTime shouldRun count elapsedTime roundTo3Digits delay |
>> roundTo3Digits := [:num |
>> | rounded lowDigit |
>> rounded := (num * 1000) rounded. "round to 1/1000"
>> lowDigit := (rounded numberOfDigitsInBase: 10) - 3. "keep only first 3 digits"
>> rounded := rounded roundTo:(10 raisedTo: lowDigit).
>> (lowDigit >= 3 or: [rounded \\ 1000 = 0]) "display fractional part only when needed"
>> ifTrue: [(rounded // 1000) asStringWithCommas]
>> ifFalse: [(rounded / 1000.0) printString]].
>> delay := aDuration asDelay.
>> count := 0.
>> shouldRun := true.
>> + Smalltalk garbageCollect.
>> [ delay wait. shouldRun := false ] forkAt: Processor timingPriority - 1.
>> startTime := Time millisecondClockValue.
>> + gcStart := (Smalltalk vmParameterAt: 8) + (Smalltalk vmParameterAt: 10).
>> [ shouldRun ] whileTrue: [ 
>> self value.
>> count := count + 1 ].
>> elapsedTime := Time millisecondsSince: startTime.
>> + gcTime := (Smalltalk vmParameterAt: 8) + (Smalltalk vmParameterAt: 10) - gcStart.
>> ^(roundTo3Digits value: count * 1000 / elapsedTime) , ' per second.', ((
>> #(
>> (1e-3 'seconds')
>> (1 'milliseconds')
>> (1e3 'microseconds')
>> (1e6 'nanoseconds')
>> )
>> detect: [ :pair | elapsedTime * pair first >= count ]
>> ifNone: [ #(1e9 'picoseconds') ])
>> in: [ :pair |
>> ' {1} {2} per run.' format: {
>> (roundTo3Digits value: elapsedTime * pair first / count).
>> + pair second } ]), (' {1} % GC time.' format: {gcTime / elapsedTime * 100 roundTo: 0.0001})!
>> - pair second } ])!
>> 
>> 
> 




More information about the Squeak-dev mailing list