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:
@@ -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=-)) ;
|
||||
}
|
||||
|
||||
@@ -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) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user