]> git.donarmstrong.com Git - lilypond.git/commitdiff
make broken_col_range() take log(N) time, by using binary search.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 8 Dec 2006 17:38:50 +0000 (18:38 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 8 Dec 2006 17:38:50 +0000 (18:38 +0100)
lily/system.cc

index c53099257f91110d63acdf5c9f2036a9b6aa97ea..c4aaca306a8ead60073a028693b60308116c7eab 100644 (file)
@@ -445,17 +445,18 @@ System::broken_col_range (Item const *left, Item const *right) const
   left = left->get_column ();
   right = right->get_column ();
 
+  
   extract_grob_set (this, "columns", cols);
-  vsize i = 0;
-  while (i < cols.size ()
-        && cols[i] != left)
-    i++;
 
+  vsize i = binary_search (cols, (Grob *) left,
+                          Paper_column::less_than);
+
+  int end_rank = Paper_column::get_rank (right);
   if (i < cols.size ())
     i++;
 
   while (i < cols.size ()
-        && cols[i] != right)
+        && Paper_column::get_rank (cols[i]) < end_rank)
     {
       Paper_column *c = dynamic_cast<Paper_column *> (cols[i]);
       if (Paper_column::is_breakable (c) && !c->system_)