Higher performance?

Brad Fuller brad at bradfuller.com
Sat Dec 23 17:47:09 UTC 2006


Todd Blanchard wrote:
> Found a preference 'Higher Performance'.
> 
> Sounds great, I love performance - what does it do?
> 
> 

The notes point to:
"May offer higer performance at the expense of other applications on 
your computer. See the comment in EventSensor>>higherPerformanceNotes 
for more details. NOT advised when running in MVC!"

... no sign of EventSensor>>higherPerformanceNotes.

There are extensive notes in EventSensor (thank you author, whomever you 
are!). Also, this might point to it's performance enhancement:


----
WorldState>>doOneCycleFor: aWorld
    "Do one cycle of the interaction loop. This method is called 
repeatedly when the world is running.

This is a moderately private method; a better alternative is usually 
either to wait for events or to check the state of things from #step 
methods."

    self interCyclePause: (Preferences higherPerformance ifTrue: [1] 
ifFalse: [MinCycleLapse]).
    self doOneCycleNowFor: aWorld.


-----
WolrdState>>interCyclePause: milliSecs
	"delay enough that the previous cycle plus the amount of delay will 
equal milliSecs.  If the cycle is already expensive, then no delay 
occurs.  However, if the system is idly waiting for interaction from the 
user, the method will delay for a proportionally long time and cause the 
overall CPU usage of Squeak to be low."

| currentTime wait |

   (lastCycleTime notNil and: [CanSurrenderToOS ~~ false]) ifTrue: [
     currentTime _ Time millisecondClockValue.
     wait _ lastCycleTime + milliSecs - currentTime.
     (wait > 0 and: [ wait <= milliSecs ] )
     ifTrue: [
       (Delay forMilliseconds: wait) wait ].
     ].

   lastCycleTime _  Time millisecondClockValue.
   CanSurrenderToOS _ true.


-- 
brad fuller
www.bradfuller.com



More information about the Squeak-dev mailing list