Skip to content

Replace foreach with for-all

Alexander Trufanov requested to merge trufanov/libktorrent:for-all into master

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-alland make sure the container is const whenever it's possible.
This does improve KTorrent performance a lot.

Edited by Alexander Trufanov

Merge request reports