Allocations at unexpected places

Hello,
I’m writing some code to compute the Vinberg algorithm (finding a finite volume polyhedron in hyperbolic space, essentially), and my code is too slow, and very memory hungry.
When tracking allocation patterns (--track-allocation=user), a specific line seems to be the worse offender. Here is a MWE.
In the original code, line 122 is the bad line, but when running the code in the MWE, I’m not sure it’s going to be as bad.
At first I thought it was simply that I should give a bit more type infos to julia, but after iterating many different ways to write this simple check in crystallographic_condition(), I’m not so sure any more.

Is there an obvious thing I’m doing wrong here?

Thanks!

OK, after discussing on the slack chat a bit, it seems I had the wrong target for optimization in mind.
This crystallographic_condition() check does make lots of allocations, but they’ll probably get garbage collected anyway.

1 Like