April 2014
Beginner to intermediate
634 pages
15h 22m
English
We'll look at two performance tweaks for the Power3 class.
First, a better algorithm. Then, a better algorithm combined with memoization, which involves a cache; therefore, the function becomes stateful. This is where callable objects shine.
The first modification is to use a Divide and Conquer design strategy. The previous version chopped
into n steps; the loop carried out n individual multiplication operations. If we can find a way to split the problem into two equal portions, the problem decomposes into
steps. Given pow1(2,1024) ...