ReAn
Dangerous Programmer...
- Local time
- Today, 10:34
- Joined
- Jun 25, 2004
- Messages
- 250
How many of you have been programming and needed a simple two way conditional aka if blah = blah then ..... else ..... end if, where one way does some less relavant code, and sometimes wondering how you should structure you're logic (aka, where relavant code should be...)
I recently conducted a series of tests to determine which was more efficient, the If clause, or the else clause.
I did a repition test on Both If and on else and noticed that when simple assignments were made
aka
z = 1
The If clause was faster, and when calculations were involved (exact same calculation)
z = z + 1
the if clause was still faster. Repition scale was 100000000, and If was about 3 seconds faster than Else (7-10 second range)
Just an interesting snipit testing the logical code design behind VBA, for those of you interested.
Edit in italic text
I recently conducted a series of tests to determine which was more efficient, the If clause, or the else clause.
I did a repition test on Both If and on else and noticed that when simple assignments were made
aka
z = 1
The If clause was faster, and when calculations were involved (exact same calculation)
z = z + 1
the if clause was still faster. Repition scale was 100000000, and If was about 3 seconds faster than Else (7-10 second range)
Just an interesting snipit testing the logical code design behind VBA, for those of you interested.
Edit in italic text
Last edited: