This article mentions that .defaultSize doesn’t work so maybe it is a bug. https://troz.net/post/2022/swiftui-mac-2022/
Post
Replies
Boosts
Views
Activity
I would also like to mention that running the code below gives me almost identical elapsed times for the matrix array and matrix buffer solutions. So, at least for this case, I'm not seeing any performance differences between the two approaches.
func runBenchmark1() {
print("Benchmark matrix multiplication")
for _ in 1...3 {
let tic = Date.now
let n = 8_000
let a = Matrix<Double>(rows: n, columns: n, fill: 1.5)
let b = Matrix<Double>(rows: n, columns: n, fill: 2.8)
let c = a * b
let toc = tic.timeIntervalSinceNow.magnitude
let elapsed = String(format: "%.4f", toc)
print("Elapsed time is \(elapsed) sec, first element is \(c[0, 0])")
}
}