Re: Exiting from a Do Loop

Tech-Archive recommends: Speed Up your PC by fixing your registry



In article <QICdnZgTcIV3bt7bnZ2dnUVZ_vGinZ2d@xxxxxxxxxxx>,
mynamehere@xxxxxxxxxxx says...

"MikeD" <nobody@xxxxxxxxxxx> wrote in message
news:efBBvpykHHA.4112@xxxxxxxxxxxxxxxxxxxxxxx


For just ONE reason why GoSub is bad, see the following:

PRB: Poor Performance with the GoSub Statement
http://support.microsoft.com/kb/174808/en-us



Did anyone notice that the code at that link does not do test what it claims to
test? In particular, the function call version does not put the loop body in a
function, it just puts the whole loop in one, and should be identical to the
inline version.

I did a real test, and found that GoSub is faster than a Sub call if compiled to
PCode, and slower by quite a bit if compiled to native. In fact, compiled to
native it is slower than itself in pcode.

Why wouldn't an "optimizing" compiler simply inline all the GoSub code where
ever it was called?

Are you optimizing for speed or program size? That would change things
quite a bit in this case.


--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
.



Relevant Pages

  • Re: Exiting from a Do Loop
    ... Poor Performance with the GoSub Statement ... PCode, and slower by quite a bit if compiled to native. ... Why wouldn't an "optimizing" compiler simply inline all the GoSub code where ...
    (microsoft.public.vb.general.discussion)
  • Re: VB language extensions wishlist
    ... FreeBASIC doesn't have GOSUB RETURN. ... used without any Result-Expression - so the compiler ... create using the GAC. ... Greatest lack in the current FreeBasic-features (one can ...
    (microsoft.public.vb.general.discussion)
  • Re: Exiting from a Do Loop
    ... Poor Performance with the GoSub Statement ... and slower by quite a bit if compiled to native. ... Why wouldn't an "optimizing" compiler simply inline all the GoSub code where ... Are you optimizing for speed or program size? ...
    (microsoft.public.vb.general.discussion)
  • Re: Exiting from a Do Loop
    ... Poor Performance with the GoSub Statement ... PCode, and slower by quite a bit if compiled to native. ... Why wouldn't an "optimizing" compiler simply inline all the GoSub code where ...
    (microsoft.public.vb.general.discussion)
  • Re: Is There Still a Need for "Turbo" Compilers?
    ... Is this because modern hardware is so fast that it ... optimizing compiler, I doubt that an optimizing compiler will ever ... they keep getting slower and slower. ...
    (comp.compilers)