How do I best speed up running of my prog?
Once I have simplified code as much as possible, made it smaller. By using loops were appropriate etc.

All ideas are welcome :D

Recommended Answers

All 2 Replies

Well, I do not know of a specific code but I do have some tips for you to help the overall functionality of your application. Most of which are listed here so check this out and I hope this helps!

-Chris

Well, I do not know of a specific code but I do have some tips for you to help the overall functionality of your application. Most of which are listed here so check this out and I hope this helps!

I found that article to be quite dated and it contains obvious errors such as the example for loop unrolling which states:

For i = 1 To 100 step 2
    b = somefun(b)
    b = somefun(b)
Next i

which clearly should have been more like

For i = 1 To 100 step 2
    b1 = somefun(i)
    b2 = somefun(i+1)
    'some other code here to do something with b1 and b2
Next i

The numerous grammatical and spelling errors make me suspect that the article was hastily written and not proofed.

Also, I can't imagine that there are any major compilers out there that don't automatically optimize an expression like

for i = 1 to len(x)-1

so that len(x) is not recalculated for each iteration of the loop. I agree with one of the comments posted that The difference in execution speed had better be significant to outweigh the loss in readability and clarity.

Having said that, there are still a few good pointers such as moving calculations that are not loop dependent out of the loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.