🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.nativeapi
Article #12194

Re: QueryPerformanceFrequency

#12194
From: David J Taylor
Date: Sat, 23 Nov 2002 11:14
38 lines
2562 bytes
"John Herbster (TeamB)" <herb-sci at novus-tele.net> wrote in message
news:3ddeb2b6$1@newsgroups.borland.com...
> "David J Taylor" <davidtaylor@writeme.com> wrote
> > > For performance measures, though, RDTSC is the better thing to use.
> >
> > Why?
>
> (1) RDTSC has higher resolution.
> (2) RDTSC requires fewer cycles to fetch readings.
> (3) Clock cycles are easier (for me) to relate to
>  machine instruction times than are nanoseconds.
> --JohnH

Agreed on (1) and (2).  (3) I think is less relevant because what matters
to the end user is time, not cycles.  (Bill also commented on resolution -
thanks).

However, I think there is a need to be careful about measuring too small
an interval because of the way that CPU and OS caching behaves.  Once code
or data is in the CPU cache (or cached from disk) a program can perform
substantially faster.  In all of my measurements:

- I skip measuring the first pass or two
- I try and time chunks of code that are reasonably large and in some way
meaningful to the program function - I'm talking of a few hundred
microseconds here.
- I average the time over the passes of the program (my programs typically
produce regualr graphical updates)

In these circumstances, the microsecond resolution of
QueryPerformanceCounter is adequate for me.

For anyone else reading the thread - the other reminder is that usually
changing the algorithm is far more important than saving one or two CPU
cycles!

Cheers,
David
Technical Details
Message-ID: <3ddf630c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-08!supernews.com!newsfeed.gamma.ru!Gamma.RU!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail
References: <3dddc45c@newsgroups.borland.com> <ha0stuk5f8isgsi777lr94gsumngrtpo3d@4ax.com> <3dde611f@newsgroups.borland.com> <3ddeb081$1@newsgroups.borland.com> <3ddeb2b6$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f94dd,64862bd85e1470d9
X-Google-Attributes: gidf94dd,public
X-Google-ArrivalTime: 2002-11-23 03:15:33 PST
From: "David J Taylor" <davidtaylor@writeme.com>
Newsgroups: borland.public.delphi.nativeapi
References: <3dddc45c@newsgroups.borland.com> <ha0stuk5f8isgsi777lr94gsumngrtpo3d@4ax.com> <3dde611f@newsgroups.borland.com> <3ddeb081$1@newsgroups.borland.com> <3ddeb2b6$1@newsgroups.borland.com>
Subject: Re: QueryPerformanceFrequency
Date: Sat, 23 Nov 2002 11:14:20 -0000
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 62.31.69.166
Message-ID: <3ddf630c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1038050060 62.31.69.166 (23 Nov 2002 03:14:20 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-08!supernews.com!newsfeed.gamma.ru!Gamma.RU!fu-berlin.de!news.uni-x.net!newsgroups.borland.com!not-for-mail