pitivi r1184 - in branches/SOC_2008_BLEWIS: . pitivi



Author: blewis
Date: Fri Jul 18 03:57:19 2008
New Revision: 1184
URL: http://svn.gnome.org/viewvc/pitivi?rev=1184&view=rev

Log:
* pitivi/utils.py:
closest_item now uses the library function bisect.bisect() instead of
the homebrew binary_search, as it returns the exact same result, and
is an order of magnitude faster :O


Modified:
   branches/SOC_2008_BLEWIS/ChangeLog
   branches/SOC_2008_BLEWIS/pitivi/utils.py

Modified: branches/SOC_2008_BLEWIS/pitivi/utils.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/utils.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/utils.py	Fri Jul 18 03:57:19 2008
@@ -22,7 +22,7 @@
 
 # set of utility functions
 
-import gst
+import gst, bisect
 
 def bin_contains(bin, element):
     """ Returns True if the bin contains the given element, the search is recursive """
@@ -64,7 +64,7 @@
 # Returns the element of seq nearest to item, and the difference between them
 
 def closest_item(seq, item):
-    index = binary_search(seq, item)
+    index = bisect.bisect(seq, item)
     if index >= len(seq):
         index = len(seq) - 1
     res = seq[index]



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