|
-
Nov 1st, 2000, 08:14 AM
#1
Thread Starter
Frenzied Member
This i not a question but for all of us. All of us have
their little trick to optimize our code, so why don't we all drop a few tips and tricks that will help everybody.
I know that i could use a few tips that will help me a lot.
Here's a tip from me:
-When you use database in your program and you have to do a lot of query on a lot of table, it could be long, why not
instead putting all element of each table in an array.
rsArray = rs.GetRows.
That way you can close your connection right away and i'll
be a lot faster!!
-
Nov 1st, 2000, 08:22 AM
#2
Well it's nice to get tips and tricks...Though some of them will be useless I think. Anyway, here's something:
- If you need timer to be faster, use two timers. The second timer calls the other one. Example: Call Timer1_Timer
- If you're going to move a form or a control, use Move instead of Top and Left. If you're resizing too, do somehow like this:
Code:
'Resizing a form into a size of control
'Add into any control
Dim NewWidth As Integer
Dim NewHeight As Integer
NewWidth = Width - ScaleWidth + Control1.Width
NewHeight = Height - ScaleHeight + Control1.Height
Move (Screen.Width - NewWidth) / 2, (Screen.Height - NewHeight) / 2, NewWidth, NewHeight
Okay, better end here...
-
Nov 1st, 2000, 09:45 AM
#3
Frenzied Member
I've learned a cool trick from Kedaman a while ago...
when you use a function and return something from the sub, use the logical = (boolean)
Code:
'Example...
'this is the WRONG (well not wrong, but LONG) way
Private Function MyFunct(x As Integer) As Boolean
'I only want to execute it if x = 5
If x = 5 Then
MyFunct = True
Else
MyFunct = False
End If
End Function
...
'Now the actual tip, you can drasticly short this code up:
Private Function MyFunct(x As Integer) As Boolean
'I only want to execute it if x = 5
MyFunct = (x=5)
End Function
'Much shorter huh?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 1st, 2000, 01:18 PM
#4
what the heck are you talking about Merry?
Anyway here are my tips:
1. Never try to access an object's property inside a speed-critical loop (unless the value of it changes inside the loop). Instead, store the value inside another variable before the loop begins, and use that instead. You will notice a massive performance increase.
2. Use StrConv to convert between a byte array and a string. (thanks to Kedaman for this one)
3. If a function is very small (doesn't do many operations) do not include it in a speed-critical loop, instead paste the contents of the function directly into the loop (if possible), this will get rid of the call delay time.
4. If you have to use a different loop for certain values of a variable, then if the loop needs to be fast, write another version of the loop in the same sub and get the value queries over with before either of the loops begin.
5. Always compile with FAST CODE optimisation (see project properties dialog box)
I like loops, can you tell? Summary: Minimise the number of queries (IF / Select Case / etc...) inside loops.
Hows that?
-
Nov 1st, 2000, 02:15 PM
#5
Hyperactive Member
I know this might be SOOOO simple but I've noticed that there are a few newbies here so this is to everyone especially the newbies:
Code:
'It's right that to do this simple thign you would:
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
a = 1
b = a + 4
c = b + a
d = a - b
e = b - c + a
x = a + b + c + d + e
y = a + b - c + d - e * x
z = 0
MsgBox a & b & c & d & e & x & y & z & vbNewLine & "These are integers!"
End Sub
'Instead you would do this:
Private Sub Command1_Click()
Dim a, b, c, d, e, x, y, z As Integer
a = 1
b = a + 4
c = b + a
d = a - b
e = b - c + a
x = a + b + c + d + e
y = a + b - c + d - e * x
z = 0
MsgBox a & b & c & d & e & x & y & z & vbNewLine & "These are integers!"
End Sub
'Yes this is "better" but the thing is that a,b,c,d,e,x,y
'would be variables that can incdlude Nodes, Integers,
'Strings etc. but only z will be an integer.
'Now you will do this:
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, d As Integer, e As Integer, x As Integer, y As Integer, z As Integer
a = 1
b = a + 4
c = b + a
d = a - b
e = b - c + a
x = a + b + c + d + e
y = a + b - c + d - e * x
z = 0
MsgBox a & b & c & d & e & x & y & z & vbNewLine & "These are integers!"
End Sub
'This is the exact code like the first one!
'Try this:
Private Sub Command1_Click()
Dim A(1 To 8) As Integer
A(1) = 1
A(2) = A(1) + 4
A(3) = A(2) + A(1)
A(4) = A(1) - A(2)
A(5) = A(2) - A(3) + A(1)
A(6) = A(1) + A(2) + A(3) + A(4) + A(5)
A(7) = A(1) + A(2) - A(3) + A(4) - A(5) * A(6)
A(8) = 0
MsgBox A(1) & A(2) & A(3) & A(4) & A(5) & A(6) & A(7) & A(8) & vbNewLine & "These are integers!"
End Sub
'This stores all the integers in one! It takes like half of the best code of the above!
'I think this post should be an article!
-
Nov 1st, 2000, 02:21 PM
#6
the function jop had shown is
like the way C does it...
int Add(int a, int b) {
return a + b;
}
and....
just to be controversial :
a good programmer always defines
a variable one to a line...
dim a as integer
dim b as integer
etc.
etc.
etc.
try to read that code when you have to
maintain the program after that guy has left
the company....
[Edited by larryn on 11-01-2000 at 02:25 PM]
-
Nov 1st, 2000, 05:56 PM
#7
Hyperactive Member
Regarding optimizing your loops, don't use an expression as the limits in a For... Statement; use variables instead. The limiting expressions get evaluated every iteration. For instance, say you are processing a string:
' This is Slow
For lng = 1 to Len(strText)
' This is Fast
lngCount = Len(strText)
For lng = 1 to lngCount
Don't use immediate ifs, as in:
var = IIf(expr,True,False)
because they execute four times slower than regular If..Then..Else constructs. (And the readability isn't so hot, either.)
For MS-Access, when you create reports, add Docmd.Maximize to the Activate event and Docmd.Restore to the Deactivate event. It's a nice touch.
-
Nov 2nd, 2000, 08:24 AM
#8
Thread Starter
Frenzied Member
Cool, it's fun to see all those tips, i have another one.
Let say your string = "c:\allo\bye\weird\humm"
And you want every word between "\" instead of
using a for next to search "\" use:
someArray=Split("String","\") and you'll have
an array of all your word between "\"
-
Nov 2nd, 2000, 08:40 AM
#9
New Member
Here`s mine
Use ADOR recordset`s (disconnected recordsets)
These are really useful to throw around data between classes etc. Also allows you to manipulate data without being connected to a database.
Also allows you to save data to a file etc.
-
Nov 2nd, 2000, 09:04 AM
#10
Addicted Member
A nice tip for databases.
When you have to run a complicated SQL-statement, make a part of it as a predefined query. Then don't open the table but the base query with only the criteria. This goes much faster then putting the whole SQL-statement in your program.
ToolTip
I was reading the tip of larryn and I thought that it might be a good idea to present the best way of reading old or somebody else's code. Goto www.vbcity.com/page.asp?p=pcp_index Registration is free, so no reason for not using this util.
Las but not least,
Don't be affraid to try and ask everything. This board is made for questions. And when it doesn't work you've still gained knoledge. There are more roads leading to rome, I believe is the expression. And don't forget VB World itself. I see many questions that are answered in one of the articals of VB World. Especialy my personal favorite guru Karl Moore. He tought me a lot in a very short time with these articles.
I might have some tips later but I'm not a professional yet. In fact I only work with VB6 for about 6 moths, with a two months of programming expirience in VBA and I have a full time job as programmer now. So you see, there hope for all you amatuers (including myself).
Catch you later,
Jeroen Hoekemeijer
Code:
If 1 = 2 Then MajorError
-
Nov 2nd, 2000, 09:11 AM
#11
Just wanted to show this one..
Well, lets say you want to read a dat file with your own tags.
You have a file on you root lets say "C:\IniFile.Dat" with two line A and B
A=Hello
B=VB-World
Code:
Public Declare Function MessageBox Lib "user32" Alias "MessageBoxA" _
(ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, _
ByVal wType As Long) As Long
Public Const MB_ICONINFORMATION = &H40&
Public Const MB_OK = &H0&
Public Const FILENAME = "C:\IniFile.Dat"
Public Function ReadFileString(TagString As String) As String
On Error GoTo Err_ReadFile
Dim sString As String
Dim Infile As Integer
Infile = FreeFile
' Open the file for reading
Open (FILENAME) For Input As Infile
' Check if there are any data aviable the file
If EOF(Infile) = True Then GoTo Err_ReadFile
' Read all the lines in the file
While Not EOF(Infile)
Line Input #Infile, sString
' If the selected tag string is be founden, place it as a return value
If Left(UCase(sString), Len(TagString)) = UCase(TagString) Then
ReadFileString = Right(sString, Len(sString) - (Len(TagString) + 1))
' Close the file
Close Infile
Exit Function
End If
Wend
' Close the file if the tag string coulnt found.
Close Infile
Exit Function
Err_ReadFile:
Call MessageBox(0, "Error reading file!", _
App.Title, MB_OK Or MB_ICONINFORMATION)
' Close the file.
Close Infile
End Function
Place this code in a module. now you can use the function to find you lines (strings).
Code:
Dim MyString As String
MyString = ReadFileString("A") & Space(1) & _
ReadFileString("B")
Do you like it..
-
Nov 2nd, 2000, 09:24 AM
#12
Ans saving...
Or if you like to save a string by a tag.. 
Code:
Public Declare Function MessageBox Lib "user32" Alias "MessageBoxA" _
(ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, _
ByVal wType As Long) As Long
Public Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" _
(ByVal lpFileName As String) As Long
Public Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
Public Const MB_ICONINFORMATION = &H40&
Public Const MB_OK = &H0&
Public Const FILENAME = "C:\IniFile.Dat"
Public Function SaveFileString(TagString As String, SaveString As String)
On Error GoTo Err_ReadFile
Dim sString As String
Dim Infile As Integer
Dim RetVal As Long
Dim inFileBackup As Integer
' Lets create a backupfile
RetVal = CopyFile(FILENAME, FILENAME & "_", 1)
Infile = FreeFile
inFileBackup = (Infile + 1)
' Open the file for readmode and savemode
Open (FILENAME) For Output As Infile
Open (FILENAME & "_") For Input As inFileBackup
' Read all the lines from your file
While Not EOF(inFileBackup)
Line Input #inFileBackup, sString
If Left(UCase(sString), Len(TagString)) = UCase(TagString) Then
Print #Infile, Left(UCase(sString), Len(TagString)) & "=" & SaveString
Else
Print #Infile, sString
End If
Wend
Close Infile
Close inFileBackup
RetVal = DeleteFile(FILENAME & "_")
Exit Function
Err_ReadFile:
Call MessageBox(0, "Error saving file", _
App.Title, MB_OK Or MB_ICONINFORMATION)
Close Infile
Close inFileBackup
Exit Function
End Function
You can use this function..
[code]
Call SaveFileString("A", "Well i have to say goodbye")
[code]
-
Nov 2nd, 2000, 12:01 PM
#13
Frenzied Member
I see you're using API to display MessageBoxes and Delete/Copy files, I hope you're aware that they're built in VB!
without the API calls it will work to my friend!
Code:
MsgBox "cool huh?"
Kill "c:\myneedlessfile.fil"
CopyFile "filename", "filename2"
.
Well, maybe you just like the api...
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 2nd, 2000, 03:23 PM
#14
Thread Starter
Frenzied Member
Here's some more :
To find the position of string within another one
InStr([start,]string1,string2[,compare])
MyPos=InStr(1,"abcdefghijklmnopqrstuvwxyz","y",1):
Would return 25
And
InStrRev, it does the same thing but it start
form the end.
Another to go with my split function in my other thread:
MyString = Join(Myarray,"\")
With put each element in a string separated by \
-
Nov 2nd, 2000, 05:43 PM
#15
Junior Member
Some tips for speed optimization
-----------------------------------------------
The percentage is the ratio of elasped time (smaller is better)
40%-Cache object references
Code:
forms(0).cmdbutton.caption
'vs.
cmdbutton.caption
60%-Use Len() to test for zero-length strings
Code:
if not len(control) = 0
'vs.
if not control = ""
35%-Use vbNullString instead of "" to initialize
Code:
text1 = vbNullstring
'vs.
text1 = ""
55%-Use Mid$ rather than concatenation
Code:
strvalue = "I like you"
mid$(strvalue,3,4) = "love"
'vs.
strvalue = left$(strvalue,2) &"love"& mid$(strvalue,7)
45%-Use StrComp to compare small strings
Code:
if strcomp(strvalue,strvalue2,vbTextCompare) = 0 then
'vs.
if ucase(strvalue) = ucase(strvalue2) then
60%-Use '$' string functions whenever possible
Code:
mid$ left$ right$
'vs.
mid left right
'vb won't have to do the extra type conversion
50%-Use integer division '\' whenever possible
- vb won't take the time convert the operands to floating-point values
70%-Use single-line logical assignments
Code:
y = (x = 5)
'vs.
if x = 5 then
y = true
else
y = false
end if
45%-Use Not to toggle between true and false
Code:
x = not x
'vs.
if x then
x = false
else
x = true
end if
'vs.
x = iif(x,false,true)
80%-Don't use Byte variables for speed
- bytes aren't faster then longs
10%-Don't call DoEvents each time you loop
15%-Put the most likely candidate first in the Select Case
75%-In arrays, For...Next instead of For Each...Next
2%-In collections, For Each...Next instead of For...Next
10%-Set a collection to New collection to clear it
10%-Use early binding
Code:
dim cmd as commandbutton
'vs.
dim cmd as control
'vs. even worse
dim cmd as object
Sorry this got a bit long, but I hope it help out those who are looking for speed.
Paul Bousa
-
Nov 2nd, 2000, 09:40 PM
#16
Fanatic Member
I like this. Here is two tips from me.
I know alot of people strip filename by using loops. Use the third method will only require one line of code and no loops.
Code:
Sub Main()
Dim str_Data As String
str_Data = "C:\Visual Basic\Test.txt"
'Method1
' Dim int_Last As Integer
' Dim int_Pos As Integer
' Do
' int_Last = int_Pos
' int_Pos = InStr(int_Pos + 1, str_Data, "\", vbTextCompare)
' If int_Pos = 0 Then Exit Do
' Loop
'
' MsgBox Mid(str_Data, int_Last + 1)
'Method2
' Dim int_X As Integer
' For int_X = Len(str_Data) To 1 Step -1
' If Mid(str_Data, int_X, 1) = "\" Then
' MsgBox Mid(str_Data, int_X + 1)
' Exit For
' End If
' Next
'Method3
MsgBox Mid(str_Data, InStrRev(str_Data, "\") + 1)
End Sub
This tip replace five lines of code with one. Use Method 2 when dealing with booleans.
Code:
Private Sub Form_Click()
' 'Method1
' If Command1.Visible = True Then
' Command1.Visible = False
' Else
' Command1.Visible = True
' End If
'Method2
Command1.Visible = Not Command1.Visible
End Sub
Chemically Formulated As:
Dr. Nitro
-
Nov 3rd, 2000, 06:30 AM
#17
Hyperactive Member
Here's a couple for you.
1)
Don't use the New operator inline on a declare.
i.e.
Dim oTmp as New SomeLib.SomeClass '/ This is bad.
use
Dim oTmp as SomeLib.SomeClass
set oTmp = new SomeLib.SomeClass '/ This is good.
The reason for this is that if you Declare with the New inline, vb will internaly check if this object has been intialised on EVERY call.
eg.
'/ Bad
Dim oTmp as New SomeLib.SomeClass
oTmp.Method1 '/ vb checks if oTmp has been initialised
oTmp.Method2 '/ again, vb checks if oTmp is initialsed
oTmp.Method3 '/ again, vb checks if oTmp is initialsed
'/ Good
Dim oTmp as SomeLib.SomeClass
set oTmp = new SomeLib.SomeClass
oTmp.Method1 '/ no check is done
oTmp.Method2 '/ no check is done
oTmp.Method3 '/ no check is done
2) If you find yourself in an environment where you are knocking out version of components on a regular basis, and you have many components installed on target systems, before you compile production releases, go round and change all your external components references to objects and change any New's into CreateObjects (keep a copy of your unchanged code for debugging).
This saves you verisoning problems when any componets on your system are updated (your current dependancy versions will go into your compile)
eg.
Before:
dim oApple as AppleCartDll.CApple
set oApple = new AppleCartDll.CApple
After:
Dim oApple as Object
set oApple = CreateObject("AppleCartDll.CApple")
If a new version of oApple comes out, it slots in 'just like that', without a lot of the headaches that can happen (those of you in this situation know what i'm talking about;-)
There is an extra overhead in using objects, but it is a question of which is more important in a given situation. You have the extra overhead, but on the plus side, you lose some of you versioning nightmares.
3) oh yeah, here's one.
Buy low, Sell high.
td.
"One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig
[email protected]
"but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.
-
Nov 3rd, 2000, 08:19 AM
#18
VB tip
Hi all,
I'm new to this forum, but glad to be here. I just thought I'd add my widows mite to the tips and tricks...
Have you ever written a dedicated routine to remove all spaces from a string? Well, here's a one liner that will work in VB6 (it uses Split and Join)
Code:
strString=Join(Split(strString),"")
or better still, use the Replace() function (I just remembered this one as I was typing):
Code:
strString=Replace(strString," ","")
Regards.
-
Nov 3rd, 2000, 08:35 AM
#19
Well here is one of my very used small subs which put at text in front of a textbox and add a dotted line with a colon at the end with constant length.
Place 2 textboxes on a form (text1 and text2) copy the program and run. You will see what I mean. It can be used in many ways, but I think it looks good.
Have fun.
Jorgen
[code]
Private Sub Form_Activate()
Dim Testtext As String
Dim TotalDistanceFromTextbox As Integer, SpaceToTextbox As Integer
TotalDistanceFromTextbox = 2200
SpaceToTextbox = 200
Testtext = "Input name"
DotText Text1, Testtext, TotalDistanceFromTextbox, SpaceToTextbox
Testtext = "Input something else"
DotText Text2, Testtext, TotalDistanceFromTextbox, SpaceToTextbox
End Sub
Public Sub DotText(DotObject As Object, YourText As String, _ TotalDistance As Integer, Space As Integer)
Dim lastx As Integer
Dim dol As Integer
Dim tw As Integer
Dim yCorrection As Integer
Dim DotSpace As Integer
Dim hx As Integer
yCorrection = 80
DotSpace = 60
dol = DotObject.Left
firstx = dol - TotalDistance
CurrentX = firstx
CurrentY = DotObject.Top + yCorrection
Print YourText;
lastx = dol - Space ' here comes the colon
CurrentX = lastx
Print ":";
tw = TextWidth(YourText)
hx = firstx + tw + DotSpace
Do Until lastx <= hx
lastx = lastx - DotSpace
CurrentX = lastx
Print ".";
Loop
End Sub
-
Nov 3rd, 2000, 09:28 AM
#20
Hi Jorgen,
I like your routine and I thought of a small enhancement--
You can put the text for the labels that you want in the
Tag property of the text boxes and then loop through all of the controls calling DotText for each one:
Code:
Text1.Tag = "First Name"
Text2.Tag = "Last Name"
Text3.Tag = "Age"
ShowLabels Me
Private Sub ShowLabels(frmForm as Form)
Dim Ctl as Control
For Each Ctl In frmForm
If Len(Ctl.Tag) > 0 Then
DotText Ctl, Ctl.Tag, 2200, 200
End If
Next Ctl
End Sub
This cleans up the code very nicely.
-
Nov 3rd, 2000, 09:32 AM
#21
transcendental analytic
jmcswain, this isn't really applying in Vb:
Regarding optimizing your loops, don't use an expression as the limits in a For... Statement; use variables instead. The limiting expressions get evaluated every iteration. For instance, say you are processing a string:
' This is Slow
For lng = 1 To Len(strText)
' This is Fast
lngCount = Len(strText)
For lng = 1 To lngCount
Since VB actually evaluates this value once, and then stores it for comparing every cycle
Code:
For n = 1 To 3 + n
Debug.Print n
Next n
On the other hand it works for Do loops. Thats why you use those when the condition is changing while in the loop.
BTW, some of my tips,
1. Don't use InStrRev. RevStr and split, they are slow, there are some functions made by Iain: myInStrRev, Mysplit, MyJoin that works a lot faster, especially for larger strings. I've done one myself fastStrReverse that reverses a string tons faster (these should be all availabe on the forum if you search for them)
2. Use Like operator, if your only purpose is to compare strings, don't use Instr and worse Instr in combination with Mid to compare.
3 In frequent loops don't use doevents every time,
Code:
if n Mod 5000 = 0 then doevents
This will process the WM's but won't waste time by checking over and over again.
3. Doevents bugs, if a doevents is called after all forms window is closed, it will hang up your app.
Therefore if you have frequent or longlasting loops, check for Forms.count before calling next doevents.
Code:
'A non time critical loop
Do While Forms.count
Doevents
'Code
Loop
'A time critical loop
Do
If n Mod 5000 = 0 then
If forms.count then
doevents
else
exit do
End if
next n
'Code
Loop
4. Binary vs Input to get contents of a file, Don't use Input#, Line Input#, not even Input$() function to get the contents of a file, they are all slow since they all check for EOF's while Get# statement don't have it. Line input is searching for linefeeds, carriage returns and carriage return linefeeds, and Input is checking for commas too. To save space use a byte array instead of varíable length string when using Get, since Variable length strings are unicode by default in vb and takes up 2X the length of the string.
5. StretchBlt vs Bitblt vs Paintpicture. Don't use Stretchblt, it's slower than Paintpicture and screws up the colors sometimes. Don't use paintpicture to copy a picture without resizing it, Bitblt is tons faster in this case. Don't use Bitblt larger areas in frequent loops if you have Autoredraw set, it will build up a huge queue of WM's and all apps including the operatring system stops responding for upto several minutes.
6. Autoredraw Can be used to redraw pictures if you ever have problems keeping the image when another window has overlapped it. Also If you store the changes to a picture set autoredraw to true and set the picture property to image property.
BTW, tumblingdown, your New declaration tip, was very helpful, thanks!
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 3rd, 2000, 10:05 AM
#22
Hi all,
Talking about writing and reading from files...If you have
a complex structure of UDT's that you want to write to a
file (actually, this works for anything that you want to
write to a file, but it's a time saver for complex UDT's),
You can try the following:
Code:
Private Type typOne
strStr1 as String
strStr2 as String
lngNumb as Long
End Type
Private Type typTwo
intNumbs() as Integer
varOne as typeOne
End Type
Private typComplexType
varArray1() as typOne
varArray2(1 To 10) as typTwo
End Type
Private Sub WriteToFile()
Open "c:\TypeFile.dat" For Binary As 1
Put #1, 1, typComplexType
Close 1
End Sub
Private Sub ReadFromFile()
Open "c:\TypeFile.dat" For Binary As 1
Get #1, 1, typComplexType
Close 1
End Sub
VB will automatically save all the data plus header
information indicating the size of the arrays (both
fixed and dynamic), lenght of strings and all that it
needs to read the data back in again.
When you read the data with Get, VB automatically uses
the information in the file to recreate the UDTs and
Redim any arrays it contains.
I know in these days of MS Access, MS SQL Server and
Oracle, people don't do this sort of thing anymore ( ),
but some of us still have to work this way.
-
Nov 3rd, 2000, 12:49 PM
#23
Hyperactive Member
Kedaman, I stand corrected. I just tested that tip last week, and there was significant speed difference
between For.. loops. But I just went and wrote a new tester after reading your snippet, and of course, you are correct.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|