[squeak-dev] The Trunk: Kernel-nice.491.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Fri Sep 10 17:41:40 UTC 2010
The problem is for micro benchmarks where the display is more like
1.40983424386e6 per second
so roundTo: 0.001 does not solve anything (the last digits are not
meaningfull at all).
Using three digits, I get
1.41e6 per second
which is already better (less pollution).
For the other suggestions, I don't know, just did the simplest modification...
Nicolas
2010/9/10 Chris Muller <asqueaker at gmail.com>:
> Hi, I've been meaning to update this for a while too. A comment and a question.
>
> Re: displaying only 3 digits, isn't roundTo: 0.001 supposed to accomplish this?
>
> Also, I am thinking that #bench should display the total time it took
> to run the block if the block could only be run once in the
> five-second limit.
>
> IOW, how sensible is it for it to display: '0.877 per second.' ??
>
> Probably, instead, it should just say, "4.123 seconds." shouldn't it?
>
> (Again, this is only in the case where it could not run more than once
> in 5 seconds).
>
> - Chris
>
>
> On Fri, Sep 10, 2010 at 7:34 AM, <commits at source.squeak.org> wrote:
>> 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 Squeak-dev
mailing list
|