Re: Inline assembler reference
- From: "anton bassov"<xxx@xxxxxxx>
- Date: Wed, 31 May 2006 20:22:15 -0500
Hi mate
When you write user-mode code (or kernel-mode one that runs below
DISPATCH_LEVEL), it is impossible to do 100%-reliable real-life profiling,
because you depend on the external conditions. To give you an idea, let's
say context switch occurs while your "time-critical loop" runs. It is
understandable that the amount of time that you have to wait before your
code is allowed to continue its execution depends on number of threads in
the system, as well as on their priority levels,events they wait on,etc,etc,
etc....
Therefore, the only thing that you can profile is execution of your code in
itself, but it does not necessarily correspond to the real-life conditions
your program runs under.
Let's say that, as a result of using assembly, you got 10-20% performance
improvement. However, if you relate this improvement to the ACTUAL (!!!)
time that elapses in between
the very first instruction of the loop gets executed and the moment the code
breaks out of the loop, it may well happen that you got just 0.1-0.2% or
even 0.01-0.02% improvement - everything depends on the external conditions
that you cannot change. In other words, the performance gains may be, for
the practical purposes, just negligible.
This is the reason why it just does not make sense to "improve" your code by
using assembly, unless you are sure that context switches, page faults, etc
cannot occur while your code runs. No wonder only small parts of Windows
kernel and HAL are written in pure assembly
Anton Bassov
.
- Follow-Ups:
- Re: Inline assembler reference
- From: Shawn B.
- Re: Inline assembler reference
- From: David J. Craig
- Re: Inline assembler reference
- References:
- Re: Inline assembler reference
- From: Shawn B.
- Re: Inline assembler reference
- Prev by Date: Re: Inline assembler reference
- Next by Date: Re: Inline assembler reference
- Previous by thread: Re: Inline assembler reference
- Next by thread: Re: Inline assembler reference
- Index(es):