The Inbox: ShoutCore-ct.71.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: ShoutCore-ct.71.mcz

commits-2
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.

=============== 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 ] ])!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: ShoutCore-ct.71.mcz

Levente Uzonyi
Hi Christoph,

On Tue, 3 Sep 2019, [hidden email] 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 ] ])!

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: ShoutCore-ct.71.mcz

Christoph Thiede

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 <[hidden email]> im Auftrag von Levente Uzonyi <[hidden email]>
Gesendet: Mittwoch, 4. September 2019 18:55:59
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: ShoutCore-ct.71.mcz
 
Hi Christoph,

On Tue, 3 Sep 2019, [hidden email] 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 ] ])!



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: ShoutCore-ct.71.mcz

timrowledge
Should point out here that #primUTCMicrosecondClock has been deprecated since 5.1 and replaced by Time class>>#utcMicrosecondClock.

And as for wrapping - well, a 64 bit value of microseconds starting at the beginning of 1901 will last quite a while. Call it a 63 bit value to stay positive, divide by 1e6, and 3600 and 24 and 365 and you get about 300,000 years in my workspace. I suspect that is far enough away to not be a practical issue. Or are we causing a Y302k problem?

> On 2019-09-04, at 11:51 AM, Thiede, Christoph <[hidden email]> wrote:
>
> 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 <[hidden email]> im Auftrag von Levente Uzonyi <[hidden email]>
> Gesendet: Mittwoch, 4. September 2019 18:55:59
> An: [hidden email]
> Betreff: Re: [squeak-dev] The Inbox: ShoutCore-ct.71.mcz
>  
> Hi Christoph,
>
> On Tue, 3 Sep 2019, [hidden email] 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 ] ])!


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
.signature not found!  reformat hard drive? [Yn]



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: ShoutCore-ct.71.mcz

Christoph Thiede

Well, I did not consider the 64 bit.


Imho a perfect solution would be completely ageless and even work properly after the Big Crunch, but in this case I guess the present benchmark performance is more important :) Just committed the changes into the Inbox.


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von tim Rowledge <[hidden email]>
Gesendet: Mittwoch, 4. September 2019 21:09:26
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Inbox: ShoutCore-ct.71.mcz
 
Should point out here that #primUTCMicrosecondClock has been deprecated since 5.1 and replaced by Time class>>#utcMicrosecondClock.

And as for wrapping - well, a 64 bit value of microseconds starting at the beginning of 1901 will last quite a while. Call it a 63 bit value to stay positive, divide by 1e6, and 3600 and 24 and 365 and you get about 300,000 years in my workspace. I suspect that is far enough away to not be a practical issue. Or are we causing a Y302k problem?

> On 2019-09-04, at 11:51 AM, Thiede, Christoph <[hidden email]> wrote:
>
> 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 <[hidden email]> im Auftrag von Levente Uzonyi <[hidden email]>
> Gesendet: Mittwoch, 4. September 2019 18:55:59
> An: [hidden email]
> Betreff: Re: [squeak-dev] The Inbox: ShoutCore-ct.71.mcz

> Hi Christoph,
>
> On Tue, 3 Sep 2019, [hidden email] 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 ] ])!


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
.signature not found!  reformat hard drive? [Yn]





Carpe Squeak!