Speeding up pkg_version and perhaps other port utilities
Stephen Montgomery-Smith
stephen at math.missouri.edu
Mon May 21 20:00:59 UTC 2007
Stephen Montgomery-Smith wrote:
>> 2. Profile bsd make and see if there are any bottlenecks. I bet make
>> was never designed for speed in these kinds of situations. But this
>> would be a long term project, albeit definitely worth doing.
>
> It looks to me like the variables are stored as a linear list in the
> "make" program. Thus if you have something like 500 variables (e.g. try
> a "make -d g1 -V XX | grep = | wc -l" in a port) it is going to take
> quite some time to search through all the variables to find one. This
> is especially a problem for variable assignments using "?=" which first
> has to search to see if the variable is already defined. And there are
> a lot of "?=" in bsd.port.mk, 298 of them. I haven't done any profiling
> yet, but I bet that this is what is taking up all the time. Probably
> the way to solve this is to rewrite src/usr.bin/make/var.c so that it
> uses some more sophisticated way of storing the variables - maybe
> Berkeley databases is the way to go. I almost get the feeling that if
> make were completely rewritten in perl that it would go faster!
Profiling indicated that the linear lists were not the bottleneck. I
get the feeling that make is about as fast as it can be.
More information about the freebsd-ports
mailing list