[squeak-dev] The Inbox: ShoutCore-ct.71.mcz
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Wed Sep 4 18:51:29 UTC 2019
Hi Levente,
thanks for the hint. I see #primUTCMicrosecondClock is more efficient, but do we really want to risk a clock wrap here (integer overflow)?
Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Levente Uzonyi <leves at caesar.elte.hu>
Gesendet: Mittwoch, 4. September 2019 18:55:59
An: squeak-dev at lists.squeakfoundation.org
Betreff: Re: [squeak-dev] The Inbox: ShoutCore-ct.71.mcz
Hi Christoph,
On Tue, 3 Sep 2019, commits at source.squeak.org wrote:
> A new version of ShoutCore was added to project The Inbox:
> http://source.squeak.org/inbox/ShoutCore-ct.71.mcz
>
> ==================== Summary ====================
>
> Name: ShoutCore-ct.71
> Author: ct
> Time: 3 September 2019, 2:20:09.991948 pm
> UUID: 2635dce1-6bda-3a4d-a726-3f66bb7c6431
> Ancestors: ShoutCore-ul.68
>
> Use TimeStamps instead of deprecated #primUTCMicrosecondClock.
In my understanding, TimeStamp is something we have been keeping around,
because it's used for printing method timestamps, but for any other
purpose there's its superclass: DateAndTime.
With some effort, I think we could and should deprecate TimeStamp.
#primUTCMicrosecondClock is still very useful, even though DateAndTime
instances are not initialized with it anymore.
For example, this primitive has the smallest overhead[1] to measure
runtime with microsecond resolution, which is exactly what the method
SHParserST80 class >> #benchmark uses it for.
I mentioned it in an earlier mail that I intend to undeprecate it, and add
the missing primitive 243 as well, which can be used to tell the VM to
flush its time zone offset cache.
Levente
[1] It's a numbered primitive with no arguments returning an Integer. On
64-bits, that integer will stay a SmallInteger for quite a while, so
there's no overhead on the image side to invoke it.
>
> =============== Diff against ShoutCore-ul.68 ===============
>
> Item was changed:
> ----- Method: SHParserST80 class>>benchmark (in category 'benchmarking') -----
> benchmark
>
> | methods methodCount totalTime averageTime min median percentile80 percentile95 percentile99 max |
> Smalltalk garbageCollect.
> methods := OrderedCollection new: 100000.
> CurrentReadOnlySourceFiles cacheDuring: [
> | parser |
> parser := SHParserST80 new.
> SystemNavigation default allSelectorsAndMethodsDo: [ :class :selector :method |
> | source start ranges |
> source := method getSource asString.
> + start := TimeStamp now.
> - start := Time primUTCMicrosecondClock.
> ranges := parser
> rangesIn: source
> classOrMetaClass: class
> workspace: nil
> environment: nil.
> + methods addLast: { (TimeStamp now - start) asMicroSeconds. method. ranges size } ] ].
> - methods addLast: { Time primUTCMicrosecondClock - start. method. ranges size } ] ].
> methods sort: #first asSortFunction.
> methodCount := methods size.
> totalTime := methods detectSum: #first.
> averageTime := (totalTime / methodCount) rounded.
>
> min := methods first.
> median := methods at: methodCount // 2.
> percentile80 := methods at: (methodCount * 0.8) floor.
> percentile95 := methods at: (methodCount * 0.95) floor.
> percentile99 := methods at: (methodCount * 0.99) floor.
> max := methods last.
> ^'
> Methods {1}
> Total {2}ms
> Average {3}ms
> Min {4}ms {5} range(s) ({6})
> Median {7}ms {8} ranges ({9})
> 80th percentile {10}ms {11} ranges ({12})
> 95th percentile {13}ms {14} ranges ({15})
> 99th percentile {16}ms {17} ranges ({18})
> Max {19}ms {20} ranges ({21})' format: ({
> methodCount asString.
> totalTime.
> averageTime.
> min first.
> min third asString.
> min second reference.
> median first.
> median third asString.
> median second reference.
> percentile80 first.
> percentile80 third asString.
> percentile80 second reference.
> percentile95 first.
> percentile95 third asString.
> percentile95 second reference.
> percentile99 first.
> percentile99 third asString.
> percentile99 second reference.
> max first.
> max third asString.
> max second reference } replace: [ :each |
> each isNumber
> ifTrue: [ (each / 1000) printShowingDecimalPlaces: 3 ]
> ifFalse: [ each ] ])!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190904/45df35ce/attachment.html>
More information about the Squeak-dev
mailing list
|