From 49ee105c685cb84bc3057e8b7666fc0cc7090047 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Wed, 13 Apr 2005 03:16:33 +0000 Subject: Fix performance degradation introduced by the second expansion feature. I did this by adding intelligence into the algorithm such that the second expansion was only actually performed when the prerequisite list contained at least one "$", so we knew it is actually needed. Without this we were using up a LOT more memory, since every single target (even ones never used by make) had their file variables initialized. This also used a lot more CPU, since we needed to create and populate a new variable hash table for every target. There is one issue remaining with this feature: it leaks memory. In pattern_search() we now initialize the file variables for every pattern target, which allocates a hash table, etc. However, sometimes we recursively invoke pattern_search() (for intermediate files) with an automatic variable (alloca() I believe) as the file. When that function returns, obviously, the file variable hash memory is lost. --- dep.h | 1 + 1 file changed, 1 insertion(+) (limited to 'dep.h') diff --git a/dep.h b/dep.h index 01c31a3..7e6a853 100644 --- a/dep.h +++ b/dep.h @@ -40,6 +40,7 @@ struct dep struct file *file; unsigned int changed : 8; unsigned int ignore_mtime : 1; + unsigned int need_2nd_expansion : 1; }; -- cgit v1.2.3