Optimizing - Small Basic Featured Thread

Today, I'd like to introduce a Small Basic forum thread about Optimizing written by Ezra94.


The following excerpt piqued my interest . . . .

INTERVIEWER:  How do you decide on the trade-offs between speed and performance?

GATES:  Sometimes it’s a trade-off between adding features and executing really fast, but there are ways of having lots and lots of features and still making things fast. Basically you want to decide what the common cases are in a program, and make sure that they go straight through, that they don’t get bogged down with all these special case checks. If your main interactive loop has all sorts of checks in it, then your program is going to be slower than somebody else’s.

Full article here: https://programmersatwork.wordpress.com/bill-gates-1986/

My coding skills are getting better and I am starting to get the basics of programming. As I start writing larger and more complex programs, speed and performance will be a more relevant aspect I'll need to consider when I develop my programs. This leads to my question: What are some general tips to increase speed and improve performance?

I searched the forum and found some posts that imparted some useful knowledge:

Links to posts here:

https://social.msdn.microsoft.com/Forums/en-US/8b55760c-6bed-40ea-bd59-db9c90b31bc3/optimization?forum=smallbasic

https://social.msdn.microsoft.com/Forums/en-US/1bb8d377-3ae8-46c9-818a-24485bb66288/can-i-optimize-this-more?forum=smallbasic

Info from posts (google as well) reiterated briefly here:

1) Know when to use large variables (multi-dimensional arrays) vs. simple variables (x = 1). Simple variables are read faster but large variables can be useful to organize data and stored under one name. Look at my key stroke recorer as an example: THS130

2) Use complex calculations when needed (use check point to prevent unnecessary calculations) in main loop

3) Keep check points (if,else statements) limited in main loop

4) Delete non usable data

 

By the way, will smaller loops in a large loop (main loop) increase performance and speed?

Are these points accurate and are there more that I should be aware of?

I'll be updating these points and questions as I progress in my research.

Thanks in advance.

P.S. I give Jibba Jibba my full appreciation for providing the aforementioned article in an earlier post.


And now we have a TechNet Wiki article about this discussion.

Small Basic: Optimization

Thank you Ezra94 for sharing these great information about Small Basic optimization.