Replace foreach with for-all
I noticed that significant performance in ktorrent/libktorrent is wasted with unnecessary ref()/deref()/isShared()
calls in Qt containers. This is caused by using non-const containers in loops and foreach
loops which expanded to Q_FOREACH
.
As use of foreach
is discouraged. I've decided to review all for
loops and replace them with for-all
and make sure the container is const whenever it's possible.
This does improve KTorrent performance a lot.
Edited by Alexander Trufanov