Complex
Many of cpplex’s operations are many times faster than those in standard C++.
While this is mostly due to standard C++’s NaN checking, it is important to note that for most use cases, NaN checking is unnecessary and causes many functions to be slow.
The following table shows a list of benchmarks comparing operations on cpplex’s cpplex::Complex type and standard C++’s std::complex type. Please note that for operations with multiple definitions, the one with all complex arguments is used for testing.
Each benchmark performs the operation N = 1e+9 times while compound assigning the result to a dummy variable and printing it to ensure volatility. Each benchmark is an average of 3 runs.
Bolded runs indicate non-negligible speed gains by cpplex over standard C++.
Function |
|
|
|---|---|---|
|
0.893s |
0.887s |
|
0.893s |
0.894s |
|
0.894s |
1.193s |
|
0.895s |
8.495s |
|
0.910s |
0.916s |
|
0.885s |
0.891s |
|
0.917s |
0.910s |
|
0.916s |
0.916s |
|
0.897s |
0.904s |
|
0.911s |
0.9s |
|
0.901s |
0.898s |
|
0.901s |
0.905s |
|
0.902s |
8.649s |
|
0.911s |
9.134s |
|
0.899s |
0.899s |
|
0.893s |
0.896s |
|
0.908s |
0.906s |
|
0.901s |
35.928s |
|
0.906s |
42.850s |
|
0.901s |
25.061s |
|
0.901s |
0.902s |
|
0.905s |
0.908s |
|
0.9s |
0.9s |
|
0.911s |
35.977s |
|
0.917s |
43.233s |
|
0.908s |
25.853s |