[BUG] why is frame rate in 3.2.5 slower?

John M McIntosh johnmci at smalltalkconsulting.com
Mon Mar 11 07:01:39 UTC 2002


Alain Fischer was kind enough to send me feedback on the 3.2.5 mac 
build process and a wee note about how come the frame rate in 3.2.4 
or 3.2.5 is slower?

(Hint the Morphic folks should start reading very carefully)

3.2.4 I know about, that's a compile time bug fostered on us by a bug 
in Project  Builder.

Now  If you get one bouncing atoms morphic up then a framerate morphic,
then we see

3.2.2  33-38
3.2.3  31-38
3.2.4  24-28  (mmm as expected alas, a compile time bug)
3.2.5  29-34  (mmmm)


Yet I benched 3.2.1b6 against 3.2.6 macrobenchmarks (which only two 
lucky squeakers have right now) and got very similar numbers (3.2.6 
is slightly faster) So what gives.

Ah but I noticed that although step time for the bouncing atom 
morphic is 0, There is more that meets the eye.

So I turned higher performance on,
now I get 49-52 frames a second!!!!

mmmm

Ah, so I see there is an attempt to limit cycle rate to 50 per second in
WorldState>>interCyclePause: Mind I'm not sure how that relates to 
frame rate, so why isn't the FrameRateMorph reporting 50 here? 
(that's question one if someone wants to solve it.) Mmm if I let 
Squeak go completely idle we get a frame rate of 31 or so... Odd 
shouldn't that be 50?

Mmm if I put a print to transcript in there and look at the wait time 
I see numbers like
18 15 15 18 18 18 17 17 17 18 17 17 15 18 17 18 15 17 18 18 15 15 17 17 18
and the frame rate goes to 11...

You know I don't get to play with Morphic much but I see a flaw here. 
Shall I give a clue...

Ok it seems that on the Delay Squeak becomes idle (yes no processes 
are available to run, so the scheduler falls back to run 
primitiveRelinquishProcessor which invokes usleep(microseconds)

Golly if I look at how long it takes between the first time 
MillisecondClockValue and the last why it's

26 20 21 20 25 22 25 24 25 26 23 31 24 23 21 21 24 25 26 25 24 30 25 
29 26 21 28 22 23 26 26 24 23 22 25 30 26 22 30 29 24 25 25 24 40 23

Gee shouldn't that be 18 or so, aren't I delaying for 18 or so ms 
huh? Well yes you are you are delaying for *at least* 18... Oh so if 
I get 24 because well I don't get control back, we're asleep etc etc, 
wouldn't that screw up the math?

Short answer - yes.


So if I add the following to WorldState>>interCyclePause: Then when 
Squeak is idle I get 49 to 50 frames a second in the Morphic frame 
rate display. Which is what I though we should get, so I can't have 
too flawed a thought process here.

Hint I've not carefully written this code, but some Morphic whiz 
should check for flaws. I've not even collapsed some of the 
assignments.

WorldState>>interCyclePause:
...
	CanSurrenderToOS _ true.
	wait > 0 ifTrue: [
			actualTime _ (lastCycleTime - currentTime).
			actualTime _ actualTime - wait.
			lastCycleTime _ lastCycleTime - actualTime].


and bouncing atoms goes to
39-43

sigh, of course now I need to understand why exactly we have a 5 ms 
lag on returning from Delay. Oh that should be fun to track.


-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list