[Pkg] The Trunk: Chronology-Core-mt.51.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Nov 13 09:17:18 UTC 2019


Marcel Taeumel uploaded a new version of Chronology-Core to project The Trunk:
http://source.squeak.org/trunk/Chronology-Core-mt.51.mcz

==================== Summary ====================

Name: Chronology-Core-mt.51
Author: mt
Time: 11 November 2019, 11:40:16.217633 am
UUID: 199ad2ea-67cb-2545-84e9-4f24e577216f
Ancestors: Chronology-Core-mt.50

Improve formatting for GC pressure as suggested by Dave.

=============== 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 printShowingMaxDecimalPlaces: 5})!
- 				pair second } ])!



More information about the Packages mailing list