Bug 258497 - dolphin slow causes high cpu usage when copying files
Summary: dolphin slow causes high cpu usage when copying files
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.5
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 243237 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-01 17:50 UTC by tim blechmann
Modified: 2011-10-18 15:42 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.2


Attachments
high cpu on dual core (64.84 KB, image/jpeg)
2011-03-09 13:57 UTC, omega
Details
High i/o wait when copying file only with dolphin (109.96 KB, image/jpeg)
2011-03-09 13:58 UTC, omega
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tim blechmann 2010-12-01 17:50:59 UTC
Version:           unspecified (using KDE 4.5.4) 
OS:                Linux

when copying many small files (i.e. the linux kernel source tree), dophin shows a high cpu usage.

profiling the behavior with perf top, shows that most of the cpu time is spent in:
QUrl::operator=(QUrl const&)

Reproducible: Didn't try
Comment 1 omega 2011-03-07 21:58:30 UTC
same issue in kde 4.6.1
Comment 2 omega 2011-03-09 13:55:31 UTC
*** Bug 243237 has been marked as a duplicate of this bug. ***
Comment 3 omega 2011-03-09 13:57:43 UTC
Created attachment 57801 [details]
high cpu on dual core
Comment 4 omega 2011-03-09 13:58:46 UTC
Created attachment 57802 [details]
High i/o wait when copying file only with dolphin
Comment 5 sailorweb2 2011-05-12 08:54:35 UTC
Same issue in KDE 4.6.2 with Kubuntu 11.04. Dolphin is using full cpu and file copying is very slow.
Comment 6 Yasin Zähringer 2011-05-22 21:00:53 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Salvatore 2011-07-31 09:54:22 UTC
Same issue in KDE 4.7.0 with OpenSuse 11.4 (kernel 3.0).

Why "wishlist"?
Comment 8 Luca Tomat 2011-07-31 10:19:28 UTC
IMO this is a bug with "normal" severity.
Comment 9 Andreas Hartmetz 2011-09-21 02:20:40 UTC
Git commit 2cd2d1a4cfa1226f959047bd4a0a429382056f19 by Andreas Hartmetz.
Committed on 21/09/2011 at 04:03.
Pushed by ahartmetz into branch 'KDE/4.7'.

Undo manager: Don't prepend() to a QVector which can contain many, many items.

Use a QList instead.
A QStack is a QVector, which has an O(n) prepend method.
Conceptually it is a stack, but not always used like one, so I
haven't renamed the typedefs, so the code looks a bit (more) confusing
now. Sorry about that.
I noticed that copying several 100k files slowed down to just a few
files a second and found that most of the time was spent in
QVector<KIO::BasicOperation>::prepend(), called from
KIO::CommandRecorder::slotCopyingDone().
Another problem is memory usage, which was a few hundred megabytes.
This patch does not fix memory usage because I have a lot of memory
and it's a difficult problem :)

BUG: 257907
BUG: 258497
CCBUG: 280088

M  +9    -9    kio/kio/fileundomanager.cpp
M  +2    -2    kio/kio/fileundomanager_p.h

http://commits.kde.org/kdelibs/2cd2d1a4cfa1226f959047bd4a0a429382056f19
Comment 10 tim blechmann 2011-09-21 09:44:59 UTC
are you sure that it fixes the problem, that i originally reported? possibly some part of the kdelibs changed since my original report, but my profiling showed that most of the time was spent in QUrl::operator=(QUrl const&). this does not seems to be addressed in the patch.
Comment 11 Andreas Hartmetz 2011-09-21 10:45:49 UTC
Yes, I'm sure. There are BasicOperations in the vector, which contain two URLs. Moving around the BasicOperations in QVector::prepend() involves BasicOperation::operator=(), which uses QUrl::operator=().
If you think about it, there were only two possibilities: QUrl::operator=() is extremely slow - unlikely because Qt has enough users who would have noticed. Or it is called very often for no good reason. That is what happened here.
Comment 12 tim blechmann 2011-09-21 19:32:26 UTC
ah, wonderful, great, thanks!!!
Comment 13 Jessie A. Morris 2011-10-18 15:42:56 UTC
I just upgraded to 4.7.2 to see if this fixed it, and it appeared to. My CPU usage still went up when copying files, but not anywhere near where it used to.

Thanks!