I’m getting a little bit surprising benchmark results for multiplying certain matrices with vectors. Just changing the values stored in the vector changes the time needed for the multiplication by a factor of 50.
The test setup is pretty simple:
- A is a 101x101 Matrix
- v1 and v2 are Vectors of length 101
- All entries are Complex128
The test data is stored in data and can be used with the following code
using BenchmarkTools using JLD d = load("data.jld") A = d["A"] v1 = d["v1"] v2 = d["v2"] result1 = @benchmark $A * $v1 result2 = @benchmark $A * $v2 println(result1) println(result2)
Running this code leads for me consistently to the result
Trial(23.188 μs) Trial(1.028 ms)
I have the following questions:
- Am I doing the benchmark correctly?
- Is this result reproducible by anyone else?
- Is there a theoretical reason why changing the values should influence the speed of the multiplication?