Message-ID: <431E7655.1020204 at rftp.com> Date: Tue, 06 Sep 2005 22:10:45 -0700 From: Robert Roessler Organization: Robert's High-performance Software MIME-Version: 1.0 To: lablgtk at math.nagoya-u.ac.jp Subject: Re: Timeout (windows/linux comparison) References: <431D8AA6.20102 at laposte.net> In-Reply-To: <431D8AA6.20102 at laposte.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Matthieu Dubuget wrote: > I'm trying to draw fast curves on screen using a drawing area from lablgtk2. > I experienced very low frequencies under windows. > > I did a very small (and dirty) program, and ran it in bytecode version on > windows and linux in order to understand better my problem. > > It appears that on windows : > - the timeout is different from the expected one > - there is a maximum (at about 60 Hz) of the frequency at which I can > have a timeout work. I just did my own quick experimentation on my Windows XP system - my results differ a bit from yours. Like you, I used Unix.gettimeofday - and I noted right away that using printf as the timer "ticks" came in really messed up the results. :) So I set slots in an array with the gettimeofday values and print the array at the end of the run. I observed that GLib timeouts could be used down to 10 milliseconds (100Hz) reliably and without difficulty. Since it is not clear if this granularity is due to the timeout facility implementation or to gettimeofday itself, I then tried to run timeouts with smaller intervals and use GLib GTimers for higher accuracy in the time *measurement*... and found that GTimers do not appear to be wrapped by LablGTK (at least as of the last CVS snapshot of 7/1). :( So, either these need to be wrapped - or someone more knowledgeable can steer me to a higher-precision timing facility already available to OCaml programmers (my non-authoritative quick check of the Hump did not yield anything suitable). Robert Roessler robertr@rftp.com http://www.rftp.com