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!
News
Files Visual Basic
Strings
Math
General
Properties
Memory
Methods Search
Testing Inline ASM-VB
Strings
Math
General
Memory Search
Using inline ASM
Submit!
Early vs. Late bindingWell, the difference is really unproportional =-)
Just to make something clear:
Early binding: Checking the object under "references" and use "Dim X as ObjectName"
Late binding: Using "Dim X as Object" and later "Set X = CreateObject("ObjectName") I made a small ActiveX dll with the following code:
Then I referenced one variable using "References". Then I set the variables correctly in the Declaration section:
Their instance was created using:
And finally this was called 5x500.000 times:
User contributed notes:
Late binding: Using "Dim X as Object" and later "Set X = CreateObject("ObjectName") I made a small ActiveX dll with the following code:
Code: |
Declarations: |
Code: |
Code: |
Late % faster than Early | Late (sec) | Early (sec) |
3772,6% | 6,404157 | 0,165373 |
3818,2% | 6,454636 | 0,164735 |
3792,6% | 6,378763 | 0,163867 |
3498,2% | 6,396008 | 0,177755 |
3573,8% | 6,406381 | 0,174380 |
User contributed notes:
Author: VBBR () | Date: 23:03 20/03/2004 |
And are there any speed differences between Dim a as SomeThing 'later on... Set a = New SomeThing and Dim a as New SomeThing ??? |
|
Author: VBBR () | Date: 22:03 31/03/2004 |
Oh, I just saw a separate test for that, sorry. | |
Author: Tom (hurendo_kun at hotmail dot com) | Date: 04:09 23/09/2005 |
Late-binding also occurs when you declare "Dim obj as Object" and set it later with "Set obj = New objType." Using the CreateObject function will make it considerably slower because not only is it a function call, but it has to look up the object definition in the type library. Maybe you should add a third test to the mix? |