[squeak-dev] Delay on Linux (was: wait2ms)

tim Rowledge tim at rowledge.org
Fri Feb 8 18:20:49 UTC 2013


On 08-02-2013, at 4:46 AM, Frank Shearar <frank.shearar at gmail.com> wrote:

> On 8 February 2013 12:36, Igor Stasenko <siguctua at gmail.com> wrote:
>> On 8 February 2013 10:41, Stéphane Rollandin <lecteur at zogotounga.net> wrote:
>>>> Yes, the effect is much more evident on Linux than on Windows, where
>>>> a delay of "2 ms" might be perhaps 15 ms or so in actual duration:
>>>> 
>>>> Time millisecondsToRun: [(Delay forMilliseconds: 2) wait] ==> 16
>>> 
>>> 
>>> This is very bad ! This makes squeak unusable for real-time animation or
>>> music. Can it be fixed ?
>>> 
>> no without modifying VM i think ...
> 
> I suspect you're right, Igor: on Cog there's much less variance
> 
> (1 to: 100) collect: [:i | [(Delay forMilliseconds: 2) wait] timeToRun]
> 
> "on Cog =>  #(2 4 2 2 4 2 2 4 2 4 4 2 4 2 2 4 2 4 4 2 2 2 2 4 2 2 2 4
> 4 2 4 2 2 4 4 2 4 2 2 4 4 2 2 2 4 4 2 4 2 2 2 4 2 2 2 4 2 2 2 4 2 2 4
> 2 2 4 4 2 2 2 4 2 2 2 4 2 4 4 2 4 4 2 4 4 2 2 4 2 2 2 2 4 2 2 2 4 2 2
> 2 4)"
> "on Interpreter => #(18 41 41 25 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 2 2 2 2 2 2 2 2 2 2 2 2 2
> 2 2 2 2 2 2 2)"
> 
> frank

Oh deary me. Looks like you might need to use a *real* operating system.

On Pi RISC OS, plain old interpreter -
|times|
times _ OrderedCollection new:100.
100 timesRepeat:[
start _ Time millisecondClockValue.
(Delay forMilliseconds: 1) wait.
times add: Time millisecondClockValue - start].
times

-> an OrderedCollection(2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)


tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
"Bother" said Pooh, as he realised Piglet was undercooked.




More information about the Squeak-dev mailing list