Optimization: don't use 'dependency graph caching'. Experiments show

it does not help at all, but complicates the code.

* build/generators.jam
  (construct-with-caching): Remove
  (construct-without-caching): Rename to 'construct-really'.

* build/virtual-target.jam:
  (clone-template, clone-action-template): Remove.


[SVN r26544]
This commit is contained in:
Vladimir Prus 2004-12-17 14:38:05 +00:00
parent d267aafb7b
commit bb5850109c
2 changed files with 2 additions and 164 deletions

View File

@ -946,57 +946,9 @@ local rule select-dependency-graph ( options )
.construct-stack = ;
# Attempt to construct the target by looking at transformation cache.
local rule construct-with-caching (
project name ? : target-type multiple ? : property-set : sources * )
{
local result ;
# Caching is only possible when we're not computing cacheable transformation
# already, when there's only one source which has no action -- i.e. source file,
# and name of target is not specified.
if ! $(.caching) && ! $(sources[2]) && $(sources[1]) && ! $(name)
&& ! [ $(sources[1]).action ]
{
local .caching = true ;
local t = $(sources[1]) ;
local signature = [ sequence.join [ $(t).type ] $(target-type) $(property-set) : - ] ;
# Get a transformation template from cache or create it.
local cresult ;
if $(.transformation.cache.$(signature))
{
cresult = $(.transformation.cache.$(signature)) ;
}
else
{
local ut = [ new file-target % : [ $(t).type ] : "no project" ] ;
cresult = [ construct $(project) : $(target-type) $(multiple)
: $(property-set) : $(ut) ] ;
.transformation.cache.$(signature) = $(cresult) ;
}
# Substitute the real source name in the transformation template.
if $(cresult)
{
result += $(cresult[1]) ;
generators.dout [ indent ] "*** putting to cache?" ;
for local c in $(cresult[2-])
{
generators.dout [ indent ] "*** cloning " $(c) ;
local cc = [ virtual-target.clone-template $(c) : $(t) : $(project) ] ;
generators.dout [ indent ] "*** cloned" $(cc) --- $(cc) ;
result += $(cc) ;
}
}
}
return $(result) ;
}
# Attempts to construct target by finding viable generators, running them
# and selecting the dependency graph
local rule construct-without-caching (
local rule construct-really (
project name ? : target-type multiple ? : property-set : sources * )
{
viable-generators = [ find-viable-generators $(target-type) : $(property-set) ] ;
@ -1085,13 +1037,8 @@ rule construct ( project name ? : target-type multiple ? : property-set * : sour
}
generators.dout [ indent ] " properties:" [ $(property-set).raw ] ;
local result = [ construct-with-caching $(project) $(name)
local result = [ construct-really $(project) $(name)
: $(target-type) $(multiple) : $(property-set) : $(sources) ] ;
if ! $(result) {
result = [ construct-without-caching $(project) $(name)
: $(target-type) $(multiple) : $(property-set) : $(sources) ] ;
}
decrease-indent ;

View File

@ -939,115 +939,6 @@ rule clone-action ( action : new-project : new-action-name ? : new-properties ?
return $(cloned-action) ;
}
# Clones a dependency graph template, given one of its root,
# and a new source target to instantinate the template with.
#
# If 'target's name is "%" and type is equal to 'new-source's
# return 'new-source', otherwise created a new target:
# - if there "%" in target's name, its replaced with 'new-target's
# - project for new target is the same as for 'new-target'
# - other attributes are copied
#
# If 'dont-recurse' is not set, clones action, which results in
# cloning of other targets, and, ultimately, cloning of the
# entire dependency graph.
#
# The 'new-project' parameter tells what project should be assigned
# for newly created non-source targets.
rule clone-template ( target dont-recurse ? : new-source : new-project : dont-register ? )
{
local name = [ $(new-source).name ] ;
local old-name = [ $(target).name ] ;
local new-name = $(old-name) ;
local m = [ MATCH (.*)(%)(.*) : $(old-name) ] ;
if $(m)
{
if [ $(target).action ]
{
new-name = [ sequence.join $(m[1]) $(name:D=) $(m[3]) ] ;
}
else
{
new-name = [ sequence.join $(m[1]) $(name) $(m[3]) ] ;
}
}
if $(old-name) = % && [ $(target).type ] = [ $(new-source).type ]
{
return $(new-source) ;
}
else
{
local cloned = [ new file-target $(new-name) : [ $(target).type ] :
$(new-project) ] ;
$(cloned).set-intermediate [ $(target).intermediate ] ;
if ! $(dont-recurse) && [ $(target).action ]
{
local cloned-action = [ clone-action-template
[ $(target).action ] $(target) $(cloned) : $(new-source) : $(new-project) ] ;
cloned-targets = $(cloned) ;
for t in [ $(cloned-action).targets ]
{
if $(t) != $(target)
{
cloned-targets +=
[ clone-template $(t) dont-recurse : $(new-source) : $(new-project)
# We don't want to pass new targets vis 'register' util we've
# finished building them -- i.e. until we assign the action.
# It might seem registering this not-yet ready target is
# harmless, but in fact the 'register' logic expects than
# registered target is never changed later.
: dont-register ] ;
}
}
local cloned-targets2 ;
for local t in $(cloned-targets)
{
$(t).action $(cloned-action) ;
cloned-targets2 += [ register $(t) ] ;
}
$(cloned-action).set-targets $(cloned-targets2) ;
cloned = $(cloned-targets2[1]) ;
}
else
{
if ! $(dont-register)
{
cloned = [ register $(cloned) ] ;
}
}
return $(cloned) ;
}
}
# Clones an action template: helper for clone-template above.
local rule clone-action-template ( action from cloned-from : new-source : new-project )
{
local targets ;
local sources ;
for local t in [ $(action).sources ]
{
sources += [ clone-template $(t) : $(new-source) : $(new-project) ] ;
}
local action-class = [ modules.peek $(action) : __class__ ] ;
local ps = [ $(action).properties ] ;
local cloned = [ new $(action-class) [ $(action).targets ] : $(sources)
: [ $(action).action-name ] : $(ps) ] ;
return $(cloned) ;
}
class subvariant
{
import sequence ;