Re: Question about the ERL function
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Fri, 12 Aug 2005 13:08:00 -0500
"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
.
- References:
- Question about the ERL function
- From: Francois Houde
- Question about the ERL function
- Prev by Date: Re: Hex to Dec and back
- Next by Date: Re: Winsock disconnect while looping with timer function
- Previous by thread: Re: Question about the ERL function
- Next by thread: Error using MovePrevious
- Index(es):
Relevant Pages
|