- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


3172:Activation and Use of the CPUWindow in the IDE

KEYWORDS: CPUWindow, Disassembly View, Registers, Assembly, Debugger AREA: App

Warning: The CPU window function is not fully tested and may fail
in some cases. If you are having problems with the debugger or
your program while using it you should disable it and this may
solve your problem. Generally leave it off unless you have a
specific need for it.

Delphi 2 has a built in feature, that is off by default,
called the CPU window or DisassemblyView. It is easy to
use and can be useful in debugging as well as in comparing
code for optimization.

        To activate this feature, run REGEDIT and edit the
registry in the following way.
Go to HKEY_CURRENT_USER\Software\Borland\Delphi\2.0\Debugging.
Once there add a new string key called "ENABLECPU". The value
of the new key will be the string "1". That is all it takes.
Now in thge Delphi IDE Select View|CPUWindow.This should bring
up the new window.

       Now to use this powerful feature to do comparative
analysis on 2 snippets that do the same work with different
source code use the following procedure.

        Create 2 identical event handlers. Inside of each
event handler place one of the snippets to be compared.
Place a breakpoint on the first line within each handler.
Run the application and activate the events. Compare the
assembly code for each method. Is one shorter? If so this
will execute faster.

        Cases worthy of this analysis are lines of code that
will execute repeatedly, code that must be optimized for
real time application, or code in applications that have to
be as fast as possible for whatever reason.

        A great example of code that accomplishes the same
thing but produces different performance is the "with object
do" construct. Many times the source code will be longer
using the "with object do" construct but the unassembled
code will be shorter. Many times you set properties in a
series for dynamically created objects. The code:

with TObject.create do
begin
  property1 := ;
  property2 := ;
  property3 := ;
end;

executes faster than:

MyObj := TObject.create;
MyObj.Property1 := ;
MyObj.Property2 := ;
MyObj.Property3 := ;


        TI



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile