diff options
author | Marc Mutz <[email protected]> | 2025-06-17 15:31:01 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-06-18 02:35:02 +0200 |
commit | 5844e06a40b8cffecf1d603d5c740ee9b81c821d (patch) | |
tree | 69a1abdb319a2ccffa3688d7569f00b9b74a560f /src/tools/moc/generator.cpp | |
parent | d29b41e0e32d4a07bf08fdd9a3dd2439c51ec292 (diff) |
Calling QList::move(int, int), which is linear in the distance between
the two indices, in a loop is quadratic (O(D*N) instead of O(D), where
N is the number of elements moved ("count") and D is the distance
between the two indices (abs(sourceRow - destinationChild))).
Fix by using std::rotate(), which is linear in D.
The code is also more readable, because the inputs to rotate() are a)
the interval to move and b) the destination position. The old code was
doing wild calculations with the indices that would have taken this
author very long to understand if he actually had to change it.
Amends da9aeb3e4ec63876e48d024772f0f0bd0b790157.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I6117a3701c097b3586633d776505855f61dbc04f
Reviewed-by: David Faure <[email protected]>
Diffstat (limited to 'src/tools/moc/generator.cpp')
0 files changed, 0 insertions, 0 deletions