After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 603661 - Banshee uses a lot of CPU
Banshee uses a lot of CPU
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Playback
git master
Other Linux
: Normal normal
: 1.6
Assigned To: Alexander Kojevnikov
Banshee Maintainers
Depends on: 581103
Blocks:
 
 
Reported: 2009-12-03 00:56 UTC by bartheerman
Modified: 2010-03-22 16:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
debug log generated by running banshee with the --debug-sql option (745.67 KB, text/plain)
2009-12-03 05:30 UTC, corhere
Details
Debug log from 'banshee-1 --debug-sql > log.txt' (105.23 KB, text/plain)
2009-12-03 10:23 UTC, bartheerman
Details
Banshee run with turned on for CROSS JOIN debugging (61.46 KB, text/plain)
2010-01-14 06:23 UTC, Kevin Duffus
Details
CoreTracks schema (2.55 KB, text/plain)
2010-03-15 15:47 UTC, Kevin Duffus
Details
CoreSmartPlaylistEntries schema (235 bytes, text/plain)
2010-03-15 15:48 UTC, Kevin Duffus
Details

Description bartheerman 2009-12-03 00:56:55 UTC
This is what happens:

1. I start banshee. No problem there.
2. I start a song. CPU remains normal (around 15% on my machine)
3. I switch to another song. Depending on my luck CPU rises to 65% - 195%
4. Switching to another song always brings CPU usage to 195%. From this moment on, switching to another song using any method (selecting in the list, using next/previous, end of song) brings CPU to 197% and the GUI hangs.

I think this is caused by the size of my library. When I import half the songs (about 2000 songs), CPU usage is around 70% and GUI is going slower but it is not hanging. If I remember well, version 1.4 did not have this problem.
Comment 1 Alexander Kojevnikov 2009-12-03 01:28:41 UTC
This issue is related to bug 581103. Marking it as dependent on it. Patch is coming...
Comment 2 Alexander Kojevnikov 2009-12-03 01:30:15 UTC
To make sure that's the case, could you run banshee from terminal, switch songs a couple of times and attach the log file?

$ banshee-1 --debug-sql > log.txt
Comment 3 corhere 2009-12-03 05:30:26 UTC
Created attachment 148983 [details]
debug log generated by running banshee with the --debug-sql option

I have been having similar issues with performance. My library contains ~7600 songs and no videos. I have attached a debug-sql log.
Comment 4 bartheerman 2009-12-03 10:23:19 UTC
Created attachment 148993 [details]
Debug log from 'banshee-1 --debug-sql > log.txt'
Comment 5 Alexander Kojevnikov 2009-12-04 08:50:25 UTC
I added a patch to the bug 581103 which should fix this issue as well. Please test: attachment 149074 [details] [review]
Comment 6 bartheerman 2009-12-04 13:29:03 UTC
I downloaded the code from the GIT repo and applied the patch. There seems to be an improvement. Normal use of Banshee makes CPU usage go to a maximum of about 100%. Fast switching between songs still drives CPU usage up to 160%.
I was wondering... Is there a way to tell Banshee to use a different DB engine? For example MySQL or so?

Thanks for the patch !
Comment 7 Alexander Kojevnikov 2009-12-27 02:40:07 UTC
I committed the patch and closed the bug this one depended on.

Regarding switching to another DB engine, I'm not sure there's anything much faster than sqlite. Even if there is, I doubt any active developers would want to work on this. It would be a major undertaking and there are plenty of more important bugs and features to work on.

I'm going to close this bug. Short spikes in CPU usage during song changes are normal and expected: we do need to recalculate smart playlists when playcounts and timestamps change.

Feel free to re-open if any of the queries still run longer than ±500ms.
Comment 8 Kevin Duffus 2010-01-14 06:23:45 UTC
Created attachment 151382 [details]
Banshee run with turned on for CROSS JOIN debugging

With CROSS JOIN turned on, switching songs results in 24000+ms delays and GUI locking. I've reverted the patch and updates average <100ms.

SQL 2.8.17 and 3.6.16 currently installed on Ubuntu Karmic
Comment 9 Alexander Kojevnikov 2010-03-15 05:35:26 UTC
Kevin, could you run these two commands in terminal and paste the output?

$ sqlite3 ~/.config/banshee-1/banshee.db ".schema CoreTracks"
$ sqlite3 ~/.config/banshee-1/banshee.db ".schema CoreSmartPlaylistEntries"

Thanks!
Comment 10 Kevin Duffus 2010-03-15 15:47:56 UTC
Created attachment 156185 [details]
CoreTracks schema
Comment 11 Kevin Duffus 2010-03-15 15:48:37 UTC
Created attachment 156186 [details]
CoreSmartPlaylistEntries schema
Comment 12 Alexander Kojevnikov 2010-03-15 22:12:54 UTC
(In reply to comment #11)
> Created an attachment (id=156186) [details]
> CoreSmartPlaylistEntries schema

Hmm, you are missing this index:

CREATE INDEX CoreSmartPlaylistEntriesIndex ON CoreSmartPlaylistEntries(SmartPlaylistID, TrackID);

Could you create it and see if that fixes it?
Comment 13 Kevin Duffus 2010-03-22 16:03:56 UTC
Alexander: Wow! Significant speed improvement. Adding that entry certainly fixed it. Thank you.