Re: Question about the ERL function

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Francois Houde" <FrancoisHoude@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:09A71969-F5CA-43FE-80CC-13984E45F41D@xxxxxxxxxxxxxxxx
> I've read that the ERL function slows down VB and Access. Is it true ?
and
> if so is it a big impact on performance ?
>
> Thanks
>
> Francois Houde

I don't know about MSAccess, but using line numbers does create a compiler
switch which turns off some kinds of optimization. (Or does it? More later
on.)

Note: It isn't the ERL() function itself that is the cause of this - it is
the very fact of using line numbers in the first place.

However, before anyone starts to panic they should bare in mind two facts.
1. Line numbers can be of two forms
a) The simple number as in
12 A$ = "abc"
or
b) A12: A$ = "abc"

We normally think of the latter as only associated with jump commands -
"Goto" and Error Handling - which is true, but they are also line numbers
"jump address". So if you use error-handling - you effectively turn off some
optimizations as well.

That said - it is not clear if that switch has any real effect anyway. It is
incredibly difficult to write and test VB code that gets optimized by
optimizing routines that delete lines. (It is interesting to note that
moving lines around has no effect since once VB is compiled the line numbers
are just "jump labels" with a new 'number' assigned to them, but it keeps
its 'name' - "a12:", "12", "34", ....)

IMHO: It appears that while the VB "preprocessor" creates interesting
switches for the next phase, the C2 compiler - most of them appear to be
ignored most of the time. <g>

Also when you setup an Error Handler you are in effect adding more 'clicks'
to your code that theoretically effect performance far more than turning off
some obscure optimization - an optimization that may never be needed in the
first place.

2. The ERL() function, IF called or used in code, causes a mechanism to be
set up that captures these jump points as the program runs and updates a
value. It is this value which is read. So again theoretically there is an
impact on your code (that module), I assure you it is highly optimized and
impact is d*mn tough to measure.

NO ONE is going to suggest you abandom error-handling, or not use the very,
very, very useful facility of line number reporting in a distributed
application. Anyone that considers that a viable option for saving a few
'clicks' - likely needs to re-consider. <g>

My favorite Bruce McKinney quote: "It doesn't matter how fast it is, if it
doesn't work"! To go along with that consider the fact that the fastest
running program you can compile is one that has no code it in. <g>

-ralph



.



Relevant Pages

  • Re: Missed jmp Optimization?
    ... code that I'm posting about. ... This will generate a forward jump, ... that this optimization wasn't used because it wasn't a sure ... code without the jump should be generated by default by the compiler. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: compiler generated output
    ... > compiler to generate code which only uses 386 instruction). ... > Thus, while replacing mov/and with movzx, the jump is still there. ... mov eax, ... Software Optimization Guide for ...
    (comp.lang.asm.x86)
  • Re: Compiler inserts redundant comparison against zero
    ... jl condition_false cmp eax, ... It's not like stunning new algorithms have been developed over the years that allow compilers to check whether expressions have side effects (this is what would prevent us from doing whatever optimization we like in the face of shortcut evaluation). ... If a compiler really missed opportunities because it's translating a && b as "test a; jump if false; test b; jump if false", no matter what a and b are, it's not really optimizing this at all. ...
    (comp.lang.asm.x86)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... what experienced programmers do, ... optimization, ... Thugs" ad nauseum fits that a lot more closely than discussing compiler ... be modified outside a loop, and guessing ...
    (comp.programming)
  • Re: Simple example of database made "forth way"?
    ... arise situations in which code readability and maintainability are of ... advantages of abstraction for readability. ... fields where the optimization is not about sequential fields at ... optimization in the compiler, or to switch to assembler to do it. ...
    (comp.lang.forth)