Micro-optimization: speed up connection-matrix rendering

Bundle::type_channel_to_overall() takes a mutex and
iterates over all ports. With a large number of channels
in a bundle this. This reduces complexity from O(2N^2) to O(N^2)
This commit is contained in:
Robin Gareus
2025-07-01 13:50:22 +02:00
parent d9fda4ce7a
commit 9897074fcc

View File

@@ -186,17 +186,16 @@ PortMatrixGrid::render (cairo_t* cr)
x = bx;
for (uint32_t k = 0; k < _matrix->count_of_our_type ((*i)->bundle->nchannels()); ++k) {
ARDOUR::BundleChannel c[2];
c[_matrix->column_index()] = ARDOUR::BundleChannel (
(*i)->bundle,
(*i)->bundle->type_channel_to_overall (_matrix->type (), k)
);
y = by;
for (uint32_t l = 0; l < _matrix->count_of_our_type ((*j)->bundle->nchannels()); ++l) {
ARDOUR::BundleChannel c[2];
c[_matrix->column_index()] = ARDOUR::BundleChannel (
(*i)->bundle,
(*i)->bundle->type_channel_to_overall (_matrix->type (), k)
);
c[_matrix->row_index()] = ARDOUR::BundleChannel (
(*j)->bundle,
(*j)->bundle->type_channel_to_overall (_matrix->type (), l)