3 ms·
A curious thing about Swift: after https://github.com/attractivechaos/plb2/pull/23 https://github.com/attractivechaos/plb2/pull/23, the matrix multiplication ex
by GrumpySloth 3y ago
A curious thing about Swift: after https://github.com/attractivechaos/plb2/pull/23 https://github.com/attractivechaos/plb2/pull/23, the matrix multiplication example is comparable to C and Rust. However, I don’t see a way to idiomatically optimise the sudoku example, whose main overhead is allocating several arrays each time solve() is called. Apparently, in Swift there is no such thing as static array allocation. That’s very unfortunate.
- attractivechaos 3y agoFigure updated. Now swift is pretty fast on nqueen+matmul but it has the longest green bar (i.e. longest running time for sudoku). This looks ... interesting. There are only 20 thousand array allocations in total, not a lot. Javascript also has these many arrays allocated/deallocated but it is 4 times as fast.