Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

VS 2012 Optimizing Loops for Speed.

$
0
0
I have some code I wrote whilst programming a calculator. Basically the code will loop 53 thousand times before it then writes 53 thousand items to a ListBox control. I'm fairly new to programming, and the only optimization I thought practical to implement to optimize the speed of the program was to swap out my inter data types for shorts and constants where possible.

I can't post the entirety of my code for fear of being plagiarized. But I can elaborate on anything you may have questions about in posts below.

Here's the loop:

Name:  Capture.PNG
Views: 68
Size:  18.3 KB

Right now I'm getting my results in a minute and 20 seconds on a quad core. As I'm posting this I'm realizing I can remove the loop subtracting 255 from subIncrement, from the loop containing it, and change subIncrement to a short data type.

Any input on this is appreciated. :)
Attached Images
 

Viewing all articles
Browse latest Browse all 27329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>