2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Optimize scanner construction. Instead of calling property.select on raw

properties list for each file, use a cache keyed by property-set instance.


[SVN r31055]
This commit is contained in:
Vladimir Prus
2005-09-20 13:11:47 +00:00
parent f2a0ea9dec
commit 32c629f4ac
2 changed files with 12 additions and 8 deletions

View File

@@ -27,7 +27,7 @@
# way, instead of relying on just target type.
import "class" : new ;
import property virtual-target ;
import property virtual-target property-set ;
# Base scanner class.
class scanner
@@ -87,21 +87,25 @@ class common-scanner : scanner
# Returns an instance of previously registered scanner,
# with the specified properties.
rule get ( scanner-class : properties * )
rule get ( scanner-class : property-set )
{
if ! $(scanner-class) in $(.registered)
{
error "attempt to get unregisted scanner" ;
}
local r = [ property.select $(.relevant-properties.$(scanner-class)) :
$(properties) ] ;
local r = $(.rv-cache.$(property-set)) ;
if ! $(r)
{
r = "" ;
}
r = [ property-set.create
[ property.select $(.relevant-properties.$(scanner-class)) :
[ $(property-set).raw ] ] ] ;
.rv-cache.$(property-set) = $(r) ;
}
if ! $(scanner.$(scanner-class).$(r:J=-))
{
scanner.$(scanner-class).$(r:J=-) = [ new $(scanner-class) $(r) ] ;
scanner.$(scanner-class).$(r:J=-) = [ new $(scanner-class) [ $(r).raw ] ] ;
}
return $(scanner.$(scanner-class).$(r:J=-)) ;
}

View File

@@ -156,7 +156,7 @@ rule set-scanner ( type : scanner )
rule get-scanner ( type : property-set )
{
if $(.scanner.$(type)) {
return [ scanner.get $(.scanner.$(type)) : [ $(property-set).raw ] ] ;
return [ scanner.get $(.scanner.$(type)) : $(property-set) ] ;
}
}