You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-5Lines changed: 19 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,7 +105,7 @@ __Arithmetic Operations__
105
105
###Language-independent optimization
106
106
107
107
108
-
*__Re-arranging Expressions__ : More efficient code for the evaluation of an expression can often be produced if the operations occuring in the expression are evaluated in a different order. Classic examples are Horner's Rule <sup> [12] </sup>, Karatsuba Multiplication <sup> [13] </sup>, fast complex multiplication <sup> [14] </sup>, fast matrix multiplication <sup> [15], [16] </sup>, fast exponentiation <sup> [29], [30] </sup>, fast factorials/binomials <sup> [40], [41] </sup>.
108
+
*__Re-arranging Expressions__ : More efficient code for the evaluation of an expression (or the computation of a process) can often be produced if the operations occuring in the expression are evaluated in a different order. Classic examples are Horner's Rule <sup> [12] </sup>, Karatsuba Multiplication <sup> [13] </sup>, fast complex multiplication <sup> [14] </sup>, fast matrix multiplication <sup> [15], [16] </sup>, fast exponentiation <sup> [29], [30] </sup>, fast factorials/binomials <sup> [40], [41] </sup>, fast fourier transform <sup> [53] </sup>, sorting by merging <sup> [51] </sup>, sorting by powers <sup> [52] </sup>.
109
109
110
110
111
111
*__Constant Substitution/Propagation__ : Many times an expression is under all cases evaluated to a single constant, the constant value can be replaced instead of the more complex and slower expression (sometimes compilers do that).
@@ -132,7 +132,7 @@ __Arithmetic Operations__
132
132
*__Handling Trivial/Special Cases__ : Sometimes a complex computation has some trivial or special cases which can be handled much more efficiently by a reduced/simplified version of the computation (eg computing a^b, can handle the special cases for a,b=0,1,2 by a simpler method). Trivial cases occur with some frequency in applications, so simplified special case code can be quite useful. <sup> [31], [32] </sup> . Similar to this, is the handling of common/frequent computations (depending on application) with fine-tuned or faster code.
133
133
134
134
135
-
*__Exploiting Mathematical Theorems/Relations__ : Some times a computation can be performed in an equivalent but more efficient way by using some mathematical theorem, transformation, symmetry <sup> [50] </sup> or knowledge (eg. Gauss method of solving Systems of Linear equations, Fast Fourier Transforms, Fermat's Little Theorem, Taylor-Mclaurin Series Expasions, Trigonometric Identities, etc..). This can go a long way. It is good to refresh your mathematical knowledge every now and then.
135
+
*__Exploiting Mathematical Theorems/Relations__ : Some times a computation can be performed in an equivalent but more efficient way by using some mathematical theorem, transformation, symmetry <sup> [50] </sup> or knowledge (eg. Gauss method of solving Systems of Linear equations <sup> [54] </sup>, Fast Fourier Transforms <sup> [53] </sup>, Fermat's Little Theorem <sup> [55] </sup>, Taylor-Mclaurin Series Expasions, Trigonometric Identities <sup> [56] </sup>, etc..). This can go a long way. It is good to refresh your mathematical knowledge every now and then.
136
136
137
137
*__Using Efficient Data Structures__ : Data structures are the counterpart of algorithms (in the space domain), each efficient algorithm needs an associated efficient data structure for the specific task. In many cases using an appropriate data structure (representation) can make all the difference (eg. database designers and search engine developers know this very well) <sup> [27], [28], [49] </sup>
138
138
@@ -227,7 +227,7 @@ else
227
227
```
228
228
229
229
230
-
*__Array Linearization__ : This involves handling a multi-dimensional array in a loop, as if it was a (simpler) one-dimensional array. Most times multi-dimensional arrays (eg 2D arrays NxM) use a linearization scheme, when stored in memory. Same scheme can be used to access the array data as if it is one big 1-dimensional array. This results in using a single loop instead of multiple nested loops <sup> [21], [22] </sup>
230
+
*__Array Linearization__ : This involves handling a multi-dimensional array in a loop, as if it was a (simpler) one-dimensional array. Most times multi-dimensional arrays (eg 2D arrays NxM) use a linearization scheme, when stored in memory. Same scheme can be used to access the array data as if it is one big 1-dimensional array. This results in using a single loop instead of multiple nested loops <sup> [21], [22], [57] </sup>
231
231
232
232
__example:__
233
233
@@ -236,9 +236,9 @@ __example:__
236
236
// nested loop
237
237
// N = M = 20
238
238
// total size = NxM = 400
239
-
for (i=0; i<20; i++)
239
+
for (i=0; i<20; i+=1)
240
240
{
241
-
for (j=0; j<20; j++)
241
+
for (j=0; j<20; j+=1)
242
242
{
243
243
// usually a[i, j] means a[i + j*N] or some other equivalent indexing scheme,
244
244
// in most cases linearization is straight-forward
@@ -380,6 +380,13 @@ Database Access can be expensive, this means it is usually better to fetch the n
0 commit comments