is there a refernce where i could know

ApiProcX 10 clock cycles on PII
ApiProcY 20 clock cycles on PII

or just

ApiProcX is faster than ApiProcY

THX
Posted on 2001-09-28 08:44:11 by Bit7
No... and would that be very useful? Just how many tasks perform
the same function?

Basically, mosts APIs are slow. Every API that causes a detour to
kernelmode is slow enough that you don't really have to worry too
much about speed... like, who uses CreateFile inside a speed-sensitive
loop? =).

One of the areas where it *does* matter is thread synchronization.
Most of the synchronization routines (WaitForSingleObject and
friends) cause kernelmode detours, and are as such slow. The
critical section routines run usermode unless the critical section is
already entered, and are as such fast.

Where else could it matter... multimedia, I guess. Dunno about
those.

Anyway, cycle listings for APIs would probably not be very
useful. Many of them have lots of checks and do different things
depending on different flags. Some depend on hardware or other
events that are external to the API call (can you predict the amount
of cycles used by WaitForMultipleObject? ;).
Kernel-mode switch overhead will also have to be taken into
account.

So for most APIs you'd end up with some pretty large figures, that
also wary by a large amount.
Posted on 2001-09-28 09:11:04 by f0dder