babl: look deeper, and longer for path fishes
authorØyvind Kolås <pippin@gimp.org>
Thu, 12 Jul 2018 14:47:10 +0000 (16:47 +0200)
committerØyvind Kolås <pippin@gimp.org>
Thu, 12 Jul 2018 14:49:04 +0000 (16:49 +0200)
We now do two iterations of +1 and +2 path lengths that take much longer than
the configured path lengths - and now complain with a debug output listing the
set of conversions taken to satisfy the request - giving hints on what parts
could possibly be shortened to fewer steps.

With this commit the first level of searching deeper also gets a debug message
which would cause GIMP to print a message in some places where it earlier
wouldnt have warned about missing fast paths.

babl/babl-fish-path.c

index a22314d81a10b8d9ef534be8ba7403f43cb4a0b7..30c4a68bf8c94d118ce72e6d51ec03204a0d5a0f 100644 (file)
@@ -568,8 +568,28 @@ babl_fish_path2 (const Babl *source,
     /* second attempt,. at path length + 1*/
     if (babl->fish_path.conversion_list->count == 0 &&
         max_path_length () + 1 <= BABL_HARD_MAX_PATH_LENGTH)
+    {
       get_conversion_path (&pc, (Babl *) source, 0, max_path_length () + 1, tolerance);
 
+      if (babl->fish_path.conversion_list->count)
+      {
+        fprintf (stderr, "babl is using a rather long chain, room exists for optimization here\n");
+        babl_list_each (babl->fish_path.conversion_list, show_item, NULL);
+      }
+    }
+
+    /* third attempt,. at path length + 2 */
+    if (babl->fish_path.conversion_list->count == 0 &&
+        max_path_length () + 2 <= BABL_HARD_MAX_PATH_LENGTH)
+    {
+      get_conversion_path (&pc, (Babl *) source, 0, max_path_length () + 2, tolerance);
+      if (babl->fish_path.conversion_list->count)
+      {
+        fprintf (stderr, "babl is using very long chain, should be optimized\n");
+        babl_list_each (babl->fish_path.conversion_list, show_item, NULL);
+      }
+    }
+
     babl_in_fish_path--;
     babl_free (pc.current_path);
   }