A few minutes ago, Harry Spier wrote: > I've just started using the "time" function to check the timings of > some functions in my program. I'm testing the timings of two > functions, each of these functions takes a list of lists and > transforms it into another list of lists. The size of each list of > lists is in the order of about 1000 x 1000. > > Each time I used it in DRacket I got very different results. So I > did this test. I put three calls to the two functions right after > each other in the program as follows. > [...] > > and got these results > > cpu time: 7176 real time: 6620 gc time: 4537 > cpu time: 2262 real time: 2289 gc time: 437 > > cpu time: 5600 real time: 5257 gc time: 2949 > cpu time: 3728 real time: 3516 gc time: 1748 > > cpu time: 4040 real time: 3673 gc time: 1388 > cpu time: 2418 real time: 2311 gc time: 422 > > Its in DrRacket on a dual core pentium under windows. > > Why the widely divergent timings
They're not that far off -- if you subtract the gc time. In general, for such timing it's best to run the code several times, possibly with calling `collect-garbage' between calls. > and why is CPU time in general more than real-time? (This looks weird, maybe you're using multiple cores?) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! ____________________ Racket Users list: http://lists.racket-lang.org/users