Re: Delay()
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Aug 15, 1998
- 420 views
A very good point, Mathew. I have already amended the pause() routine in my little box of tricks. jiri -----Original Message----- From: Mathew Hounsell <mat.hounsell at MAILEXCITE.COM> To: EUPHORIA at cwisserver1.mcs.muohio.edu <EUPHORIA at cwisserver1.mcs.muohio.edu> Date: Saturday, August 15, 1998 8:31 PM Subject: Delay() >Alan(?) Coded : >procedure Delay(atom seconds) >atom now > > now = time() > while (time() - now) < seconds do > end while >end procedure > >However this is more accurate : > >procedure Delay(atom seconds) >atom until > > until = time() + seconds > while time() < until do > end while >end procedure > >Why? Well the first version of delay is doing a function call, a load, a calculation and then a comparison each time. >But calculations take time. >The second code does the calculation once. It then only does the function call and comparison each time. > >The later is logically quicker. However it is all relative as no *human* would percieve it. >A machine might. > >----- >Sincerely, >Mathew Hounsell >Mat.Hounsell at Mailexcite.Com > > > > >Free web-based email, Forever, From anywhere! >http://www.mailexcite.com >