On Monday, 2 March 2020 at 20:22:55 UTC, p.shkadzko wrote:
[snip]

Interesting growth of processing time. Could it be GC?

+------------------+-------------+
| matrixDotProduct | time (sec.) |
+------------------+-------------+
| 2x[100 x 100]    |        0.01 |
| 2x[1000 x 1000]  |        2.21 |
| 2x[1500 x 1000]  |         5.6 |
| 2x[1500 x 1500]  |        9.28 |
| 2x[2000 x 2000]  |       44.59 |
| 2x[2100 x 2100]  |       55.13 |
+------------------+-------------+

Your matrixDotProduct creates a new Matrix and then returns it. When you look at the Matrix struct, it is basically building upon D's GC-backed slices. So yes, you are using the GC here.

You could try creating the output matrices outside of the matrixDotProduct function and then pass them by pointer or reference into the function if you want to profile just the calculation.

Reply via email to