[Banshee-List] Small Performance Patch 2



Hello,

I was not able to reproduce the errors Aaron got with this patch, I was never setting the Playing Iter any more, so
this was maybe the root of the problem, It seems that the TrackCellInd function is called a lot!! many more times as i
was expecting, i eliminate completely the SyncPlayingIter and set the PlayingIter Property in the TrackCellInd Function,
it may be my impression but in some of the tests the time of changing from a playlist to the library was a lot less that
with this function, it make sense, in a worse case scenario the whole library was being scanned +1 time.

Please check this version out Aaron, I hope this has that problem you saw fixed and that i have saved you some time.

regards,

Oscar.

PS: Great about the genre support, short question can i use generics then? and the new generic collections??
? burn-sharp/.deps
? burn-sharp/.libs
? burn-sharp/glue.lo
? burn-sharp/libnautilusburnglue.la
? libbanshee/.deps
? libbanshee/.libs
? libbanshee/gst-cd-rip-0.8.lo
? libbanshee/gst-misc-0.8.lo
? libbanshee/gst-playback-0.8.lo
? libbanshee/gst-transcode-0.8.lo
? libbanshee/hal-context.lo
? libbanshee/inotify-glue.lo
? libbanshee/libbanshee.la
? libbanshee/xing/.deps
? po/.intltool-merge-cache
? src/.PlaylistModel.cs.swp
? src/.PlaylistView.cs.swp
? src/Banshee.Base/.Source.cs.swp
Index: src/PlaylistModel.cs
===================================================================
RCS file: /cvs/gnome/banshee/src/PlaylistModel.cs,v
retrieving revision 1.33
diff -u -r1.33 PlaylistModel.cs
--- src/PlaylistModel.cs	8 Feb 2006 07:39:25 -0000	1.33
+++ src/PlaylistModel.cs	28 Feb 2006 09:24:31 -0000
@@ -74,28 +74,7 @@
             };
         }
     
-        public void SyncPlayingIter()
-        {
-            if(PlayerEngineCore.ActivePlayer.Track == null) {
-                playingIter = TreeIter.Zero;
-            } else {
-                for(int i = 0, n = Count(); i < n; i++) {
-                    TreeIter iter;
-                    if(!IterNthChild(out iter, i))
-                        continue;
-                        
-                    TrackInfo ti = IterTrackInfo(iter);
-                    
-                    if(PlayerEngineCore.ActivePlayer.Track.Equals(ti)) {
-                        playingIter = iter;
-                        break;
-                    }
-                }
-            }
-        }
-    
         // --- Load Queue and Additions ---
-    
         private bool OnIdle()
         {
             QueueSync();
@@ -114,7 +93,7 @@
 
             trackInfoQueue.Clear();
             trackInfoQueueLocked = false;
-            SyncPlayingIter();
+            //SyncPlayingIter();
             
             return;
         }
@@ -134,6 +113,7 @@
         {
             AddTrack(ti, true);
         }
+
         
         public void AddTrack(TrackInfo ti, bool raiseUpdate)
         {
@@ -155,8 +135,6 @@
             foreach(TrackInfo track in SourceManager.ActiveSource.Tracks) {
                 AddTrack(track);
             }
-            
-            SyncPlayingIter();
         }
 
         // --- Helper Methods ---
@@ -418,8 +396,11 @@
             }
         }
         
-        public TreeIter PlayingIter
-        {
+        public TreeIter PlayingIter {
+			set {
+				playingIter = value;
+			}
+
             get {
                 return playingIter;
             }
Index: src/PlaylistView.cs
===================================================================
RCS file: /cvs/gnome/banshee/src/PlaylistView.cs,v
retrieving revision 1.39
diff -u -r1.39 PlaylistView.cs
--- src/PlaylistView.cs	8 Feb 2006 07:39:25 -0000	1.39
+++ src/PlaylistView.cs	28 Feb 2006 09:24:31 -0000
@@ -338,15 +338,16 @@
         protected void TrackCellInd(TreeViewColumn tree_column,
             CellRenderer cell, TreeModel tree_model, TreeIter iter)
         {
-            CellRendererPixbuf renderer = (CellRendererPixbuf)cell;
-            TrackInfo ti = model.IterTrackInfo(iter);
-            if(ti == null) {
-                return;
+            TrackInfo ti = tree_model.GetValue(iter, 0) as TrackInfo;
+            if((ti != null) && (PlayerEngineCore.ActivePlayer.Track != null)) {
+                CellRendererPixbuf renderer = (CellRendererPixbuf) cell;
+                if(PlayerEngineCore.ActivePlayer.Track.Equals(ti)) {
+                    renderer.Pixbuf = nowPlayingPixbuf;
+					model.PlayingIter = iter;
+                } else {
+                    renderer.Pixbuf = ti.CanPlay ? null : songDrmedPixbuf;
+                }
             }
-            
-            renderer.Pixbuf = iter.Equals(model.PlayingIter)
-                ? nowPlayingPixbuf
-                : (ti.CanPlay ? null : songDrmedPixbuf);
         }
         
         protected void RipCellInd(TreeViewColumn tree_column, CellRenderer cell, 
@@ -469,7 +470,6 @@
         
         public void UpdateView()
         {
-            model.SyncPlayingIter();
             QueueDraw();
             ScrollToPlaying();
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]