Eric Blake wrote:
> I'm shocked at how much difference this made, touching just m4sh!
> Pre-patch, running autoconf on coreutils took 22.270s, after it takes
> 18.127s; an 18% speedup, and with no change to configure contents.
> 
> The concept of this patch is that one-shot initialization routines, like
> AS_REQUIRE, are expensive.  Rather than calling the initialization every
> single time, as a no-op that just finds out that things were already
> initialized, it is nicer to define two versions of the same macro - one
> that does the initialization and popdef's itself, and another that does
> the common work.  In fact, the common version can often be m4_define'd
> rather than m4_defun'd: the main reason for m4_defun is for self-providing
> and for saving location details to print a nicer error stack about any
> detected dependency errors; but once the one-shot initializer has
> completed successfully, we know there are no dependency problems and the
> macro is provided, so we should no longer care about using the m4_defun
> prolog to track location, and m4_require notices that the macro has
> already been provided.

I'm not sure tracking the location is not useful.  As a first step, you
can use m4_define if the common version is empty and m4_defun otherwise.

Paolo


Reply via email to