Show Menu


Stop testing when answer found
Order tests by frequency in switch and if-else structures
Substitute switch statement for if-else construct
Lookup Table
Substitute table lookups for compli­cated expres­sions
Lazy Evaluation
Only a few entries are ever used. Cache them for further use it may be better to compute values as needed.


If the decision doesn’t change while looping turn the loop inside out
Combines two or more loops into one. Reduces loop overhead
Replaces a loop with straig­ht-line code. With partial unrolling, two or more cases are handled inside
Minimize work
Put calcul­ations that result in a constant before the loop
Sentinel Values
Special value that marks the end of an array. Replaces expensive compound tests
Busy Loop Inside
Putting the busiest loop on the inside


Routines - Inline
Rewrite routines inline
Routine - Rewrite
Rewrite expensive system routines
Data tran – Float/Int
Replace f.p. numbers with integers
Data tran – Array Dims
Reduce array dimensions where possible
Data tran – Array Refs
Minimize array references
Data tran – Supp
Length index for arrays
Data tran – Caching
Save commonly used values, instead of recomp­uting or rereading them
Exp - Str redu
Replace expensive operations with cheaper ones
Exp - Compile Time
Initialize at compile time
Exp - Data Type
Use the proper data type for constants
Common Sub-Exp
Eliminate common subexp­res­sions
Exp - Precompute
Better to look up values than to recompute them

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          More Cheat Sheets by Heavenel