GNOME Bugzilla – Bug 678576
GIOScheduler performance enhancements
Last modified: 2012-06-25 21:08:26 UTC
This bit is the top CPU usage in my app.
Created attachment 216969 [details] [review] GIOScheduler: Avoid constant iteration over pending job list The iteration over the list (while holding a mutex) was a serious performance hit for asynchronous I/O. We can just use g_cancellable_connect().
Created attachment 216970 [details] [review] GIOScheduler: Use a GList, not GSList for jobs In general, code using g_slist_delete_link() is broken, because it potentially requires an O(n) traversal. Just switch to GList in this case. The performance hit here was exacerbated by the fact that we were holding a mutex that needed to be accessed by all threads.
Review of attachment 216969 [details] [review]: Looks reasonable. Do we have any tests that exercise this functionality ?
Review of attachment 216970 [details] [review]: Looks fine, but this may very well be superseded by the GTask work soon...
(In reply to comment #3) > Review of attachment 216969 [details] [review]: > > Looks reasonable. Do we have any tests that exercise this functionality ? Yep, gio/tests/cancellable.c hits this heavily.
(In reply to comment #4) > Review of attachment 216970 [details] [review]: > > Looks fine, but this may very well be superseded by the GTask work soon... True. There'll likely be code outside of GLib using GSimpleAsyncResult for quite a while though. These patches are also a convenient target for backporting if someone else hits this problem.
Attachment 216969 [details] pushed as 2839297 - GIOScheduler: Avoid constant iteration over pending job list Attachment 216970 [details] pushed as 991d07d - GIOScheduler: Use a GList, not GSList for jobs
The GCancellable patch is causing crashes (including in the regression tests...). After looking at it for a bit I think the best thing to do is revert it for the release today and revisit the issue after...
Created attachment 217207 [details] [review] Revert "GIOScheduler: Avoid constant iteration over pending job list" This reverts commit 2839297686a9305b4fa909b93c337ef1d1a5e94b. Conflicts: gio/gioscheduler.c
Created attachment 217208 [details] [review] Revert "GIOScheduler: Avoid constant iteration over pending job list" This reverts commit 2839297686a9305b4fa909b93c337ef1d1a5e94b. Conflicts: gio/gioscheduler.c
(In reply to comment #8) > The GCancellable patch is causing crashes (including in the regression > tests...). > > After looking at it for a bit I think the best thing to do is revert it for the > release today and revisit the issue after... Can you give me more information? What host environment? Which tests are crashing? Can you give stack traces?
Created attachment 217220 [details] [review] GIOScheduler: Disconnect from cancellable after job completes This was causing crashes when a cancellable was canceled after the job had completed.
Comment on attachment 217208 [details] [review] Revert "GIOScheduler: Avoid constant iteration over pending job list" Committed and did the 2.33.3 release.
Comment on attachment 217220 [details] [review] GIOScheduler: Disconnect from cancellable after job completes Reverted the previous commit and committed this on master after the release. We've already gotten feedback that it was fixing the issues that everyone was seeing and the testcases are passing as well.