[Pkg] The Trunk: Kernel-nice.491.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Sep 10 12:35:01 UTC 2010


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.491.mcz

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

Name: Kernel-nice.491
Author: nice
Time: 10 September 2010, 2:33:29.294 pm
UUID: 00d7b4ff-5219-aa44-b82d-be4c7f18c761
Ancestors: Kernel-ar.490

Prevent bench to display 14 digits or so.
3 significative digits should be enough for a human brain (at least mine).

=============== Diff against Kernel-ar.490 ===============

Item was changed:
  ----- Method: BlockClosure>>bench (in category 'evaluating') -----
  bench
  	"See how many times I can value in 5 seconds.  I'll answer a meaningful description."
  
+ 	| startTime endTime count roundTo3Digits |
+ 	roundTo3Digits := [:num | num roundTo: (10 raisedTo: (num numberOfDigitsInBase: 10) - 3)].
- 	| startTime endTime count |
  	count := 0.
  	endTime := Time millisecondClockValue + 5000.
  	startTime := Time millisecondClockValue.
  	[ Time millisecondClockValue > endTime ] whileFalse: [ self value.  count := count + 1 ].
  	endTime := Time millisecondClockValue.
  	^count = 1
+ 		ifTrue: [ (roundTo3Digits value: (endTime - startTime) // 1000) printString, ' seconds.' ]
- 		ifTrue: [ ((endTime - startTime) // 1000) printString, ' seconds.' ]
  		ifFalse:
+ 			[ ((roundTo3Digits value: (count * 1000 * 100) // (endTime - startTime)) / 100.0) printString, ' per second.' ]!
- 			[ ((count * 1000) / (endTime - startTime)) asFloat printString, ' per second.' ]!



More information about the Packages mailing list