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
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,7 @@ __Arithmetic Operations__
113
113
### Language-independent optimization
114
114
115
115
116
-
* __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. This works because by re-arranging expression/operations, what gets added or multiplied to what, gets changed, including the relative number of additions and multiplications, and thus the (overall) relative (computational) costs of each operation. In fact, this is not restricted to arithmetic operations, but any operations whatsoever using symmetries (eg commutative laws, associative laws and distributive laws, when they indeed hold, are actualy examples of arithmetic operator symmetries) of the process/operators and re-arrange to produce same result while having other advantages. That is it, so simple. Classic examples are Horner's Rule <sup> [13](#r13 "Horner rule, wikipedia") </sup>, Karatsuba Multiplication <sup> [14](#r14 "Karatsuba algorithm, wikipedia") </sup>, fast complex multiplication <sup> [15](#r15 "Fast multiplication of complex numbers") </sup>, fast matrix multiplication <sup> [18](#r18 "Strassen algorithm, wikipedia"), [19](#r19 "Coppersmith-Winograd algorithm, wikipedia") </sup>, fast exponentiation <sup> [16](#r16 "Exponentiation by squaring, wikipedia"), [17](#r17 "Fast Exponentiation") </sup>, fast factorials/binomials <sup> [20](#r20 "Comments on Factorial Programs"), [21](#r21 "Fast Factorial Functions") </sup>, fast fourier transform <sup> [57](#r57 "Fast Fourier transform, wikipedia") </sup>, fast fibonacci numbers <sup> [76](#r76 "Fast Fibonacci numbers") </sup>, sorting by merging <sup> [25](#r25 "Merge sort, wikipedia") </sup>, sorting by powers <sup> [26](#r26 "Radix sort, wikipedia") </sup>.
116
+
* __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. This works because by re-arranging expression/operations, what gets added or multiplied to what, gets changed, including the relative number of additions and multiplications, and thus the (overall) relative (computational) costs of each operation. In fact, this is not restricted to arithmetic operations, but any operations whatsoever using symmetries (eg commutative laws, associative laws and distributive laws, when they indeed hold, are actualy examples of arithmetic operator symmetries) of the process/operators and re-arrange to produce same result while having other advantages. That is it, so simple. Classic examples are Horner's Rule <sup> [13](#r13 "Horner rule, wikipedia") </sup>, Karatsuba Multiplication <sup> [14](#r14 "Karatsuba algorithm, wikipedia") </sup>, fast complex multiplication <sup> [15](#r15 "Fast multiplication of complex numbers") </sup>, fast matrix multiplication <sup> [18](#r18 "Strassen algorithm, wikipedia"), [19](#r19 "Coppersmith-Winograd algorithm, wikipedia") </sup>, fast exponentiation <sup> [16](#r16 "Exponentiation by squaring, wikipedia"), [17](#r17 "Fast Exponentiation") </sup>, fast gcd computation <sup> [78](#r78 "A Binary Recursive Gcd Algorithm") </sup>, fast factorials/binomials <sup> [20](#r20 "Comments on Factorial Programs"), [21](#r21 "Fast Factorial Functions") </sup>, fast fourier transform <sup> [57](#r57 "Fast Fourier transform, wikipedia") </sup>, fast fibonacci numbers <sup> [76](#r76 "Fast Fibonacci numbers") </sup>, sorting by merging <sup> [25](#r25 "Merge sort, wikipedia") </sup>, sorting by powers <sup> [26](#r26 "Radix sort, wikipedia") </sup>.
117
117
118
118
119
119
*__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).
@@ -417,4 +417,5 @@ Database Access can be expensive, this means it is usually better to fetch the n
417
417
75. <aid="r75"href="https://en.wikipedia.org/wiki/Methods_of_computing_square_roots">Methods of computing square roots</a>
0 commit comments