Hilaire

do you want to see an animation?

Stef

On Wed, Apr 4, 2018 at 3:49 PM, Hilaire <hila...@drgeo.eu> wrote:
> Hi,
>
> I discover this Dr. Geo Smalltalk sketch to animate is about 60% slowler on
> P7 compare to P3:
>
> | fig point comment x y random inArc tries|
> "Monte-Carlo PI approximation"
> fig := DrGeoCanvas new fullscreen scale: 400.
> fig arcCenter: 0@0 from:  1@0 to: 0@1.
> fig polygon: { 0@0. 0@1. 1@1. 1@0 }.
> comment := fig texte: '' a: 0@ -0.1.
> random := Random seed: Time millisecondClockValue.
> tries := 500.
> inArc := 0.
> [1 a: tries faire: [: try |
>     x := random next.
>     y := random next.
>     point := (fig point: x@y) small.
>     (x squared + y squared) > 1
>         ifTrue: [point color: Color blue  ]
>         ifFalse: [inArc := inArc + 1 ].
> comment text: 'Tries: ', try asString, '
> approx: ', (inArc * 4 / try) asFloat asString.
> World doOneCycle.
> ] ] timeProfile
>
> The log are enclosed to compare. The mains differences seems to be during
> the world update. Years ago when porting to P3 I also see an important time
> performance degradation[1] and it remained unresolved.
>
>
> [1] http://forum.world.st/Slowness-question-tt4761717.html
>
>
>
>
> --
> Dr. Geo
> http://drgeo.eu
>

Reply via email to