autoconf-patches
[Top][All Lists]
Advanced

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

AC_CHECK_TYPE [was: [PATCH 06/12] _AC_CHECK_HEADER_MONGREL]


From: Eric Blake
Subject: AC_CHECK_TYPE [was: [PATCH 06/12] _AC_CHECK_HEADER_MONGREL]
Date: Thu, 6 Nov 2008 23:33:41 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> >> Meanwhile, before I actually work on this patch, I noticed a small 
optimization 
> >> that I will be applying soon:
> > 
> > Is this really worth it?...
> 
> For coreutils, it cut "autoconf --trace 'm4_case:$%' | wc" from 24k to 6k
> of parameter size, which in turn means less parsing during the recursion
> helpers for m4_case.  Unfortunately, I didn't measure pre- and post-
> timings to see if it was noticeable; however, I also suspect that m4 1.4.x
> sees a bigger improvement than m4.git branch-1.6 (where $@ handling is
> more efficient).

And a corresponding optimization for AC_CHECK_TYPE.  For coreutils, it shaves 
off 7k of text parsing, and 27 fewer m4_bmatch calls.  Timing wise, it wasn't 
much of a difference (AC_CHECK_TYPE is not as frequent as AC_CHECK_HEADER), but 
we might as well be consistent.  So I went ahead and committed this:


From: Eric Blake <address@hidden>
Date: Thu, 6 Nov 2008 16:29:53 -0700
Subject: [PATCH] Speed up AC_CHECK_TYPE.

* lib/autoconf/types.m4 (AC_CHECK_TYPE): Factor out $@, and avoid
regex when enough arguments are present.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog             |    6 ++++++
 lib/autoconf/types.m4 |   21 ++++++++++-----------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 37e69c7..34a61c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-06  Eric Blake  <address@hidden>
+
+       Speed up AC_CHECK_TYPE.
+       * lib/autoconf/types.m4 (AC_CHECK_TYPE): Factor out $@, and avoid
+       regex when enough arguments are present.
+
 2008-11-06  Paolo Bonzini  <address@hidden>
 
        Remove three forks per _AC_RUN_LOG_STDERR in the common case.
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index 6360d40..b8fc81a 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -248,17 +248,16 @@ m4_define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
 # 3. $2 seems to be a type          => NEW plus a warning
 # 4. default                        => NEW
 AC_DEFUN([AC_CHECK_TYPE],
-[m4_if($#, 3,
-        [_AC_CHECK_TYPE_NEW($@)],
-       $#, 4,
-        [_AC_CHECK_TYPE_NEW($@)],
-       _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1,
-        [_AC_CHECK_TYPE_OLD($@)],
-       _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1,
-        [AC_DIAGNOSE([syntax],
-                   [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)],
-       [_AC_CHECK_TYPE_NEW($@)])[]dnl
-])# AC_CHECK_TYPE
+[m4_cond([$#], [3],
+  [_AC_CHECK_TYPE_NEW],
+        [$#], [4],
+  [_AC_CHECK_TYPE_NEW],
+        [_AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2])], [1],
+  [_AC_CHECK_TYPE_OLD],
+        [_AC_CHECK_TYPE_MAYBE_TYPE_P([$2])], [1],
+  [AC_DIAGNOSE([syntax],
+              [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW],
+  [_AC_CHECK_TYPE_NEW])($@)])# AC_CHECK_TYPE
 
 
 
-- 
1.6.0.2








reply via email to

[Prev in Thread] Current Thread [Next in Thread]