From 0ab23a0072b851cdeebe42f533f2ff757517f506 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 5 Apr 2020 01:42:40 +0200 Subject: [PATCH] Add a comment about wxGridSelection::IsInSelection() complexity No real changes. --- src/generic/gridsel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index 6fcd64140f..707180fccd 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -58,6 +58,12 @@ bool wxGridSelection::IsSelection() bool wxGridSelection::IsInSelection( int row, int col ) { // Check whether the given cell is contained in one of the selected blocks. + // + // Note that this algorithm is O(N) in number of selected blocks, not in + // number of cells in the grid, so it should be reasonably efficient even + // for very large grids, as the user shouldn't be able to select too many + // blocks. If we still run into problems with this, we should find a more + // efficient way of storing the selection, e.g. using k-d trees. const size_t count = m_selection.size(); for ( size_t n = 0; n < count; n++ ) {