Does anyone know if adding DIM statements inside an IF statement is of any benifit to the speed of an Application?
In other words; Would these 2 examples produce the same compile/token code in ACCESS VBA?
DIM blah As <Object>
IF Foo = TRUE THEN
' do some work
END IF
VS
IF Foo = TRUE THEN
DIM blah As <Object>
' Do some Work
End If
if the Variable/Object is not created until inside the IF statement (read Memory Allocated) then the code should theoretically run faster ... unless the compiler has already allocated the memory within the Token code and just providing a local pointer to the Variable/object. I seem to recall that was the way DBase worked.
Anyway be interested to here other comments.
In other words; Would these 2 examples produce the same compile/token code in ACCESS VBA?
DIM blah As <Object>
IF Foo = TRUE THEN
' do some work
END IF
VS
IF Foo = TRUE THEN
DIM blah As <Object>
' Do some Work
End If
if the Variable/Object is not created until inside the IF statement (read Memory Allocated) then the code should theoretically run faster ... unless the compiler has already allocated the memory within the Token code and just providing a local pointer to the Variable/object. I seem to recall that was the way DBase worked.
Anyway be interested to here other comments.