Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75936 - trunk/tools/build/v2/build
From: steven_at_[hidden]
Date: 2011-12-13 18:31:49


Author: steven_watanabe
Date: 2011-12-13 18:31:47 EST (Tue, 13 Dec 2011)
New Revision: 75936
URL: http://svn.boost.org/trac/boost/changeset/75936

Log:
Make property-set lazier. This significantly reduces memory usage for the regression tests on Windows (about 15%).
Text files modified:
   trunk/tools/build/v2/build/property-set.jam | 153 +++++++++++++++++++++++++++------------
   1 files changed, 106 insertions(+), 47 deletions(-)

Modified: trunk/tools/build/v2/build/property-set.jam
==============================================================================
--- trunk/tools/build/v2/build/property-set.jam (original)
+++ trunk/tools/build/v2/build/property-set.jam 2011-12-13 18:31:47 EST (Tue, 13 Dec 2011)
@@ -48,49 +48,6 @@
             {
                 errors.error "Invalid property: '$(p)'" ;
             }
-
- local att = [ feature.attributes $(p:G) ] ;
- # A feature can be both incidental and free, in which case we add it
- # to incidental.
- if incidental in $(att)
- {
- self.incidental += $(p) ;
- }
- else if free in $(att)
- {
- self.free += $(p) ;
- }
- else
- {
- self.base += $(p) ;
- }
-
- if dependency in $(att)
- {
- self.dependency += $(p) ;
- }
- else
- {
- self.non-dependency += $(p) ;
- }
-
- if [ MATCH (:) : $(p:G=) ]
- {
- self.conditional += $(p) ;
- }
- else
- {
- self.non-conditional += $(p) ;
- }
-
- if propagated in $(att)
- {
- self.propagated += $(p) ;
- }
- if link-incompatible in $(att)
- {
- self.link-incompatible += $(p) ;
- }
         }
     }
 
@@ -110,6 +67,10 @@
     #
     rule base ( )
     {
+ if ! $(self.base-initialized)
+ {
+ init-base ;
+ }
         return $(self.base) ;
     }
 
@@ -117,6 +78,10 @@
     #
     rule free ( )
     {
+ if ! $(self.base-initialized)
+ {
+ init-base ;
+ }
         return $(self.free) ;
     }
 
@@ -124,21 +89,37 @@
     #
     rule dependency ( )
     {
+ if ! $(self.dependency-initialized)
+ {
+ init-dependency ;
+ }
         return $(self.dependency) ;
     }
 
     rule non-dependency ( )
     {
+ if ! $(self.dependency-initialized)
+ {
+ init-dependency ;
+ }
         return $(self.non-dependency) ;
     }
 
     rule conditional ( )
     {
+ if ! $(self.conditional-initialized)
+ {
+ init-conditional ;
+ }
         return $(self.conditional) ;
     }
 
     rule non-conditional ( )
     {
+ if ! $(self.conditional-initialized)
+ {
+ init-conditional ;
+ }
         return $(self.non-conditional) ;
     }
 
@@ -146,6 +127,10 @@
     #
     rule incidental ( )
     {
+ if ! $(self.base-initialized)
+ {
+ init-base ;
+ }
         return $(self.incidental) ;
     }
 
@@ -200,7 +185,15 @@
     {
         if ! $(self.propagated-ps)
         {
- self.propagated-ps = [ property-set.create $(self.propagated) ] ;
+ local result ;
+ for local p in $(self.raw)
+ {
+ if propagated in [ feature.attributes $(p:G) ]
+ {
+ result += $(p) ;
+ }
+ }
+ self.propagated-ps = [ property-set.create $(result) ] ;
         }
         return $(self.propagated-ps) ;
     }
@@ -209,8 +202,15 @@
     {
         if ! $(self.link-incompatible-ps)
         {
- self.link-incompatible-ps =
- [ property-set.create $(self.link-incompatible) ] ;
+ local result ;
+ for local p in $(self.raw)
+ {
+ if link-incompatible in [ feature.attributes $(p:G) ]
+ {
+ result += $(p) ;
+ }
+ }
+ self.link-incompatible-ps = [ property-set.create $(result) ] ;
         }
         return $(self.link-incompatible-ps) ;
     }
@@ -238,7 +238,7 @@
     {
         if ! $(self.as-path)
         {
- self.as-path = [ property.as-path $(self.base) ] ;
+ self.as-path = [ property.as-path [ base ] ] ;
         }
         return $(self.as-path) ;
     }
@@ -345,6 +345,65 @@
         }
         return $($(feature)) ;
     }
+
+ # private
+
+ rule init-base ( )
+ {
+ for local p in $(self.raw)
+ {
+ local att = [ feature.attributes $(p:G) ] ;
+ # A feature can be both incidental and free, in which case we add it
+ # to incidental.
+ if incidental in $(att)
+ {
+ self.incidental += $(p) ;
+ }
+ else if free in $(att)
+ {
+ self.free += $(p) ;
+ }
+ else
+ {
+ self.base += $(p) ;
+ }
+ }
+ self.base-initialized = true ;
+ }
+
+ rule init-dependency ( )
+ {
+ for local p in $(self.raw)
+ {
+ local att = [ feature.attributes $(p:G) ] ;
+
+ if dependency in $(att)
+ {
+ self.dependency += $(p) ;
+ }
+ else
+ {
+ self.non-dependency += $(p) ;
+ }
+ }
+ self.dependency-initialized = true ;
+ }
+
+ rule init-conditional ( )
+ {
+ for local p in $(self.raw)
+ {
+ if [ MATCH (:) : $(p:G=) ]
+ {
+ self.conditional += $(p) ;
+ }
+ else
+ {
+ self.non-conditional += $(p) ;
+ }
+ }
+ self.conditional-initialized = true ;
+ }
 }
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk