Boost logo

Boost-Build :

From: Pedro Ferreira (pedro.ferreira_at_[hidden])
Date: 2003-10-14 12:24:00


Hi Rene,

> No map like container... but, you an use a set of variables to gt a similar
> effect. If you have some keys-values you can:
>
> xmap-$(key1) = $(value1) ;
> xmap-$(key2) = $(value2) ;
> ...etc.

Excellent. Thanks for the tip.

> But looking at find-project-root the simple answer is to cache the searches.
> Like so:
>
> rule find-project-root ( dir )
> {
> local location = $(.project-root.$(dir)) ;
> if ! $(location)
> {
> location = [ path.glob $(dir) : project-root.jam ] ;
> }
> if ! $(location)
> {
> location = [ path.glob-in-parents $(dir) : project-root.jam ] ;
> }
> .project-root.$(dir) = $(location) ;
> return $(location) ;
> }
>
> Try that and see what the impact on timming is.

# files 1 Elapsed: 0.641
# files 5 Elapsed: 0.791
# files 10 Elapsed: 1.031
# files 50 Elapsed: 3.085
# files 100 Elapsed: 5.699
# files 200 Elapsed: 11.236
# files 300 Elapsed: 17.304
# files 500 Elapsed: 34.179
# files 1000 Elapsed: 79.064

Not bad: a 10% reduction!

Thanks for the help.

Rene or Volodya: can you please put this in the CVS?

Pedro

 ------=_NextPart_000_0182_01C39280.569C2A10 Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2733.1800" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Hi Rene,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&gt; No map like container... but, you an use a set
of variables to gt a similar<BR>&gt; effect. If you have some keys-values you
can:<BR>&gt; <BR>&gt; &nbsp;&nbsp;&nbsp; xmap-$(key1) = $(value1) ;<BR>&gt;
&nbsp;&nbsp;&nbsp; xmap-$(key2) = $(value2) ;<BR>&gt; &nbsp;&nbsp;&nbsp;
...etc.<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Excellent. Thanks for the tip.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&gt; But looking at find-project-root the simple
answer is to cache the searches.<BR>&gt; Like so:<BR>&gt; <BR>&gt; rule
find-project-root ( dir )<BR>&gt; {<BR>&gt; &nbsp;&nbsp;&nbsp; local location =
$(.project-root.$(dir)) ;<BR>&gt; &nbsp;&nbsp;&nbsp; if ! $(location)<BR>&gt;
&nbsp;&nbsp;&nbsp; {<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location
= [ path.glob $(dir) : project-root.jam ] ;<BR>&gt; &nbsp;&nbsp;&nbsp; }<BR>&gt;
&nbsp;&nbsp;&nbsp; if ! $(location)<BR>&gt; &nbsp;&nbsp;&nbsp; {<BR>&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location = [ path.glob-in-parents
$(dir) : project-root.jam ] ;<BR>&gt; &nbsp;&nbsp;&nbsp; }<BR>&gt;
&nbsp;&nbsp;&nbsp; .project-root.$(dir) = $(location) ;<BR>&gt;
&nbsp;&nbsp;&nbsp; return $(location) ;<BR>&gt; }<BR>&gt; <BR>&gt; Try thatand
see what the impact on timming is.<BR></FONT></DIV>
<DIV><FONT face="Courier New" size=2># files&nbsp;&nbsp;&nbsp; 1 Elapsed:
0.641<BR># files&nbsp;&nbsp;&nbsp; 5 Elapsed: 0.791<BR># files&nbsp;&nbsp; 10
Elapsed: 1.031<BR># files&nbsp;&nbsp; 50 Elapsed: 3.085<BR># files&nbsp; 100
Elapsed: 5.699<BR># files&nbsp; 200 Elapsed: 11.236<BR># files&nbsp; 300
Elapsed: 17.304<BR># files&nbsp; 500 Elapsed: 34.179<BR># files 1000 Elapsed:
79.064</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Not bad: </FONT>a 10% reduction!</FONT></DIV></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks for the help.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Rene or Volodya: can you please put this in the
CVS?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Pedro</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></BODY></HTML>
 ------=_NextPart_000_0182_01C39280.569C2A10--


Boost-Build 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