[asterisk-dev] slow slow menuselect (and proposal for a fix)

Luigi Rizzo rizzo at icir.org
Sat Dec 15 08:33:13 CST 2007

I experienced recently that menuselect and related processing is
taking a long long time on certain platforms, particularly if you
are using network-mounted filesystems, so investigated a bit the

The reason seems to be that, if i am not mistaken, menuselect itself
does a full pass on the entire set of sources to check dependencies.
There is a second full pass, with awk being run on each source file
while making up menuselect-tree.  This seems to happen every time
I run 'make' in the top level, even without any change in the

Remember we have over 300 files and 310k lines of C code now in the tree,
which are not a problem on a fast modern machine with a fast local
disk and large disk cache. Take one of these features away and
you'll see a huge difference.

The attempt to put in the same file (the .c source) code, documentation
and build dependencies is commendable. But in my opinion it is completely
unreasonable that we have to process 300 files and 310k lines of code
every time we run 'make', only to collect the 1000 or so lines
that we care about (and find that they are unchanged).

I see two steps to remove this inefficiency:
1. (simple): remove the dependency on menuselect.makeopts from a number
        of targets, introducing it only as a dependency for makeopts

2. (slightly harder): remove the MODULEINFO and MAKEOPTS sections
        from foo.c source files, and put them somewhere else, either
        in some foo.opts files that go along with them, and/or in a central
        place for each directory

There are at least two reasons for the latter change:
- prevent rebuilding menuselect-tree and running menuselect every time
  a simple change (e.g. bugfix or the like) is made to a C source file;
- considerably speed up rebuilding menuselect-tree and running menuselect,
  because now we have fewer and much shorter files to deal with.

Objections ? As i said #1 is relatively simple, but #2 probably
requires some help from Russell or whoever is fluent with menuselect...


More information about the asterisk-dev mailing list