public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-devel/make/files: make-3.82-glob-speedup.patch
@ 2011-09-17  5:21 Mike Frysinger (vapier)
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger (vapier) @ 2011-09-17  5:21 UTC (permalink / raw
  To: gentoo-commits

vapier      11/09/17 05:21:57

  Added:                make-3.82-glob-speedup.patch
  Log:
  Add glob optimization patch from upstream #382845 by Tomáš Chvátal.
  
  (Portage version: 2.2.0_alpha58/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  sys-devel/make/files/make-3.82-glob-speedup.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/make/files/make-3.82-glob-speedup.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/make/files/make-3.82-glob-speedup.patch?rev=1.1&content-type=text/plain

Index: make-3.82-glob-speedup.patch
===================================================================
change from upstream to speed up by skipping unused globs

https://bugs.gentoo.org/382845

--- a/read.c	2011/04/29 15:27:39	1.198
+++ b/read.c	2011/05/02 00:18:06	1.199
@@ -2901,6 +2901,7 @@
       const char *name;
       const char **nlist = 0;
       char *tildep = 0;
+      int globme = 1;
 #ifndef NO_ARCHIVES
       char *arname = 0;
       char *memname = 0;
@@ -3109,32 +3110,40 @@
 	}
 #endif /* !NO_ARCHIVES */
 
-      switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl))
-	{
-	case GLOB_NOSPACE:
-	  fatal (NILF, _("virtual memory exhausted"));
-
-	case 0:
-          /* Success.  */
-          i = gl.gl_pathc;
-          nlist = (const char **)gl.gl_pathv;
-          break;
-
-        case GLOB_NOMATCH:
-          /* If we want only existing items, skip this one.  */
-          if (flags & PARSEFS_EXISTS)
-            {
-              i = 0;
-              break;
-            }
-          /* FALLTHROUGH */
-
-	default:
-          /* By default keep this name.  */
+      /* glob() is expensive: don't call it unless we need to.  */
+      if (!(flags & PARSEFS_EXISTS) || strpbrk (name, "?*[") == NULL)
+        {
+          globme = 0;
           i = 1;
           nlist = &name;
-          break;
-	}
+        }
+      else
+        switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl))
+          {
+          case GLOB_NOSPACE:
+            fatal (NILF, _("virtual memory exhausted"));
+
+          case 0:
+            /* Success.  */
+            i = gl.gl_pathc;
+            nlist = (const char **)gl.gl_pathv;
+            break;
+
+          case GLOB_NOMATCH:
+            /* If we want only existing items, skip this one.  */
+            if (flags & PARSEFS_EXISTS)
+              {
+                i = 0;
+                break;
+              }
+            /* FALLTHROUGH */
+
+          default:
+            /* By default keep this name.  */
+            i = 1;
+            nlist = &name;
+            break;
+          }
 
       /* For each matched element, add it to the list.  */
       while (i-- > 0)
@@ -3174,7 +3183,8 @@
 #endif /* !NO_ARCHIVES */
           NEWELT (concat (2, prefix, nlist[i]));
 
-      globfree (&gl);
+      if (globme)
+        globfree (&gl);
 
 #ifndef NO_ARCHIVES
       if (arname)






^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gentoo-commits] gentoo-x86 commit in sys-devel/make/files: make-3.82-glob-speedup.patch
@ 2011-09-17  7:25 Mike Frysinger (vapier)
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger (vapier) @ 2011-09-17  7:25 UTC (permalink / raw
  To: gentoo-commits

vapier      11/09/17 07:25:06

  Removed:              make-3.82-glob-speedup.patch
  Log:
  Punt broken glob build #383311 by Lars Wendler.
  
  (Portage version: 2.2.0_alpha58/cvs/Linux x86_64)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gentoo-commits] gentoo-x86 commit in sys-devel/make/files: make-3.82-glob-speedup.patch
@ 2011-09-17 23:29 Mike Frysinger (vapier)
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger (vapier) @ 2011-09-17 23:29 UTC (permalink / raw
  To: gentoo-commits

vapier      11/09/17 23:29:34

  Added:                make-3.82-glob-speedup.patch
  Log:
  Add more complete glob optimization patch from upstream #382845 by Tomáš Chvátal.
  
  (Portage version: 2.2.0_alpha58/cvs/Linux x86_64)

Revision  Changes    Path
1.3                  sys-devel/make/files/make-3.82-glob-speedup.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/make/files/make-3.82-glob-speedup.patch?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/make/files/make-3.82-glob-speedup.patch?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/make/files/make-3.82-glob-speedup.patch?r1=1.2&r2=1.3







^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-17 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-17  7:25 [gentoo-commits] gentoo-x86 commit in sys-devel/make/files: make-3.82-glob-speedup.patch Mike Frysinger (vapier)
  -- strict thread matches above, loose matches on Subject: below --
2011-09-17 23:29 Mike Frysinger (vapier)
2011-09-17  5:21 Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox