Dim multiple lines or single line 
Author Message
 Dim multiple lines or single line

Just curious what the advantage (performance wise) is, if any, of dimming on
one line as opposed to many lines.

i.e., which of these two is slower

Dim strName, strAddress

Or

Dim strName
Dim strAddress

Preston



Tue, 24 Dec 2002 03:00:00 GMT  
 Dim multiple lines or single line
AFAIK, there's no performance difference. I tend to do it on separate lines,
strictly because I got in that habit when it was possible to "type" the
variables wien you dimmed them.

--

Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/


Quote:
> Just curious what the advantage (performance wise) is, if any, of dimming
on
> one line as opposed to many lines.

> i.e., which of these two is slower

> Dim strName, strAddress

> Or

> Dim strName
> Dim strAddress

> Preston



Tue, 24 Dec 2002 03:00:00 GMT  
 Dim multiple lines or single line

I assume that the difference is purely cosmetic because when its executed
the declaration code is run an equal number of times.

Using multilines makes a smaller script which might speed up the time that
WScript takes to parse the VBScript.

The difference (if there is any) will be so tiny you would never notice.

--
Dominic



Tue, 24 Dec 2002 03:00:00 GMT  
 Dim multiple lines or single line

Yes it does affect the final compiled exe.
Try this... create a new project, and in Form_Load:
    Dim Test1, Test2, Test3, Test4, Test5
Compile it as C:\ONE.EXE
Now change the code to this:
    Dim Test1
    Dim Test2
    Dim Test3
    Dim Test4
    Dim Test5

Now rename C:\ONE.EXE to C:\ORIGINAL.EXE, and recompile C:\ONE.EXE ...
Compare the two.
They should both be the same size, but there _are_ different bytes....
Whether or not there are any signifigant performance changes im not sure,
but yes it DOES affect the compiler



Thu, 26 Dec 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Single Command Spanning Multiple Lines

2. Display of Multiple Rows on a Single Line

3. Display of Multiple Rows on a Single Line

4. single line font

5. printing single line instead of entire page using uniprint or gs and lpr

6. How to set the curso on the first single line input text box of my page

7. Value single line text box with variable containing special characters

8. sql string on single line?

9. Output to a single line?

10. Deleting empty lines in single cell table

11. Single line textbox problem

12. Replacing a single line from a text file

 

 
Powered by phpBB® Forum Software