Q:  How efficient is inc(i)?

Here is a message that I posted on compu-serve.  It was sent in response to a post from one user to another where he suggested that calling the procedure inc(i) was not as efficient as i := i + 1;

Here is the post:  "One small optimization you can do , especially if your not using pointers is Kill the call to INC , every function call needs to allocate an activation record , local variables,... all of which suck time so why not just x := x + 1."

Here was my answer:

This is my chance to plug how great Delphi is.

x := x + 1;

yields the following assembly code:

mov  ax,  [bp-02]
inc  ax
mov  [bp-02], ax

Now, inc(i) does it this way:

inc  word ptr [bp-02]

The point here is that Delphi is *really* great at doing things fast, FAST *FAST*!  Not all function calls slow things down.