January 2020
Intermediate to advanced
532 pages
13h 31m
English
Do we sacrifice performance when we make the functions accept more general types in their arguments? Let's do some benchmarking tests and see how they perform.
Here, we will benchmark the functions for options 1, 5, 6, and 7 using exactly the same input: two Float64 vectors with 10,000 elements:
using BenchmarkTools A = rand(10_000);B = rand(10_000);@btime sumprod_1($A, $B);@btime sumprod_5($A, $B);@btime sumprod_6($A, $B);@btime sumprod_7($A, $B);
Here are the test results:

As you can see, there is no material difference between these options. How the argument types are specified does not affect the runtime performance ...
Read now
Unlock full access