Author: David Rasmussen
Date: 04:08:17 02/09/02
Go up one level in this thread
On February 09, 2002 at 03:50:27, David Dory wrote: >hi martin, > >I think your "simple experiment", as you posted in your first post, was rather >unscientific, (in the British sense of very). I may have missed something & I'm >certainly not a code guru, but I am unable to see how you are testing the >unknown against a known standard. > >It looks more like you are testing one unknown value (from the profiler), >against the other (your own timing function). I believe you will find the best >results if you test your function with one method or the other, or both, but >don't extrapolate results from one testing method to the other testing method. >You don't have (or haven't shown), a proven relationship between these two >testing methods. > >I believe the interaction of computer timing methods is too complex and variable >to make assumptions based on dissimilar testing methods without first proving a >relationship between these two methods, first. > >>>for i=0 to bignumber >>wait, i wanted to go a line down, not post the message :) >>so: >> >>t = clock(); >>for i=0 to BIGNUMBER >> test1(i); >>t1 = clock()-t; >> >>t=clock(); >>for i=0 to BIGNUMBER >> test2(i); >>t2 = clock()-t; > > >>will not produce accurate results for how fast test1 and test2 are running? > >This is much better than the first postings code, but, in Windows?? You're >joking, right? You'll come up with an approximation (certainly not down to >1/1000 sec. as the docs say)! > >If you run the exact same data thru this kind of loop, you'll see the time >varies in a clumpy pigeon-hole type fashion. > I don't know what Windows you are talking about (and this is also dependant on the compiler, actually much more than the OS), but with gcc and MSVC on Windows 2000, clock() has a pretty high resolution, and is pretty consistent. If I do something like the above, I get consistent results. If you're testing the difference between to different ways of doing the same thing, and you loop enough times, you will get an ok picture of which is faster, and by how much. But of course I use a profiler for complex problems. After all, clock() isn't guaranteed by ANSI C to have a resolution higher than 1 second even. BTW. MSVC 7 (which is in beta), doesn't have a profiler. They threw it out from MSVC 6, because they believed that it wasn't good enough, and that there were many good third party options. But which? Is there a free profiler for MSVC available? I use the profiler for gcc sometimes, but since this code is usually being compiled with MSVC, a gcc profile isn't exactly precise. /David
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.