Skip to content

Commit

Permalink
Optimization: use a const & to avoid copy when traversing matrix (#129)
Browse files Browse the repository at this point in the history
this substantially reduces the cost of a process with empty matrix
  • Loading branch information
baconpaul authored Sep 14, 2024
1 parent 8d266fb commit b6d11da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/sst/basic-blocks/mod-matrix/ModMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ template <typename ModMatrixTraits> struct FixedMatrix : ModMatrix<ModMatrixTrai
{
matrixOutputs[outIdx] = this->baseValues.at(tgt);
}
for (auto r : routingValuePointers)
for (const auto &r : routingValuePointers)
{
if (r.active && !(*r.active))
if (!r.source || !r.target)
continue;

if (!r.source || !r.target)
if (r.active && !(*r.active))
continue;

float sourceViaVal{1.f};
Expand Down

0 comments on commit b6d11da

Please sign in to comment.