» Home » VB Fibre
Site
News
Files

Visual Basic
Strings
Math
General
Properties
Memory
Methods

Search
Testing

Inline ASM-VB
Strings
Math
General
Memory

Search
Using inline ASM
Submit!

Use local module instead external

Calling external modules often is certainly slower than calling local ("internal") modules. This code has been tested with 5000000 iterations. So you wouldn't see it anyway. But for the "diehard" optimizers here, it certainly is usefull to know =-)

Code:
Public Sub TestOne() Dim lngResult As Long lngResult = Module1.CalcSomething(100, 100) End Sub Public Sub TestTwo() Dim lngResult As Long lngResult = mdlAlwaysdebug.CalcSomething(100, 100) End Sub Public Function CalcSomething(Value1 As Long, Value2 As Long) As Long CalcSomething = (Value1 + Value2) End Function

External % faster than Internal External (sec) Internal (sec)
5,7% 0,166794 0,157777
5,3% 0,170250 0,161757
7,4% 0,178605 0,166231
13,5% 0,177277 0,156137
12,3% 0,179110 0,159526


User contributed notes:

Author: Tom (hurendo_kun at hotmail dot com) Date: 15:05 31/05/2005
I don't understand what this test is trying to say. How do you differentiate between "external" and "internal" modules?

Author: Almar () Date: 19:05 31/05/2005
One of the functions was in the same module, the other in a different (.bas) file.

Add user-note
Author:
E-mail (optional):
Anti spam, please enter 'ok' without quotes:
Comment: