# Theoretical Speedup

This efficiency of the multi-domain method can be measured by the speedup coefficient. That is the ratio between the elapsed time of the original computation and the elapsed time obtained with the multi-domains method.

If the CPU cost of the main program (RAD2RAD) and time spent in communications are negligible, and that the time step and the cost per cycle of each domain are constant during the computation, an estimation of the speedup can be computed in order to determine if the use of multi-domains is relevant or not.

In the case of 2 domains, A and B, A being the domain with the smallest time step, the speedup can be obtained using the following formula: (1)
$Speedup=\frac{{T}_{MONO}}{{T}_{MULTI}}=\frac{\left(N{e}_{A}{C}_{A}+N{e}_{B}{C}_{B}\right)N{c}_{A}}{N{e}_{A}C{}_{A}N{c}_{A}+N{e}_{B}{C}_{B}N{c}_{B}}$
Where,
$Nc$
Number of cycles for each domain
$Ne$
Number of elements of each domain
$C$
Average cost per element and per cycle for each domain
The formula can be rewritten as: (2)
$Speedup=\frac{\xi +\left(1-\xi \right)\cdot \psi }{\xi \cdot \gamma +\left(1-\xi \cdot \gamma \right)\cdot \psi }$
Where,
$\xi =\frac{{C}_{A}}{{C}_{B}}$
Average cost per cycle ratio between domains
$\gamma =\frac{N{c}_{A}}{N{c}_{B}}=\frac{d{t}_{B}}{d{t}_{A}}$
Time step ratio
$\psi =\frac{N{e}_{A}}{N{e}_{A}+N{e}_{B}}$
Percentage of elements in the domain with the smallest time step
If the average cost per cycle is the same in the 2 domains then the formula becomes: (3)
$Speedup=\frac{1}{\gamma +\left(1-\gamma \right)\cdot \psi }$

Therefore, the speedup is very high when $\gamma$ and $\psi$ are close to zero, meaning that domain A is small compared to B and time step ratio is high. This is what is depicted in Figure 2.