From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-06-05 00:44:29
David Abrahams wrote:
> > The 'modules.mormalize-raw-paths' takes more time than actually building
> > targets! I think that now that "import" is required in every class, and
> > is called during construction of all instances, we *really* need to
> > optimize it -- and in particular, it should not call
> > 'normalize-raw-paths' in such a way. Thoughs?
> I think we should optimize normalize-raw-paths; it would be easy to
> make a cache of results or to stop work on a path when all of its '.'
> characters have been processed. I think the cache is probably the
> way to go, though.
First off, I think there's no point to normalize all those paths, unless
you're really going to load the module. The attached patch reduces
the number of 'normalize-raw-paths' invocations from 1544 to 76, which
translates into considerable run-time reduction.
After than, caching can help, but:
1. I don't really understand why we need to use 'normalize-raw-paths'. When I
change it to return its argument, all tests pass for me on Linux.
2. It's not that good idea to duplicate functionality already in path.jam.
--Boundary-00=_9it3+jF3G8pMe8D Content-Type: text/x-diff;
Content-Disposition: attachment; filename="import_speed.diff"
RCS file: /cvsroot/boost/boost/tools/build/kernel/modules.jam,v
retrieving revision 1.1
diff -u -r1.1 modules.jam
--- modules.jam 28 May 2003 01:33:36 -0000 1.1
+++ modules.jam 5 Jun 2003 05:43:17 -0000
@@ -265,32 +265,37 @@
errors.error when loading multiple modules, no specific rules or renaming is allowed ;
- # if the importing module isn't already in the BOOST_BUILD_PATH,
- # prepend it to the path. We don't want to invert the search
- # order of modules that are already there.
- local caller = [ CALLER_MODULE ] ;
- local cwd = [ PWD ] ;
- local caller-location ;
- if $(caller)
- caller-location = [ binding $(caller) ] ;
- caller-location = $(caller-location:D) ;
- caller-location = [ normalize-raw-paths $(caller-location:R=$(cwd)) ] ;
- local search = [ peek : BOOST_BUILD_PATH ] ;
- search = [ normalize-raw-paths $(search:R=$(cwd)) ] ;
- if $(caller-location) && ! $(caller-location) in $(search)
- search = $(caller-location) $(search) ;
+ local caller = [ CALLER_MODULE ] ;
# Import each specified module
for local m in $(module-names)
- load $(m) : : $(search) ;
+ if ! $(m) in $(.loaded)
+ # if the importing module isn't already in the BOOST_BUILD_PATH,
+ # prepend it to the path. We don't want to invert the search
+ # order of modules that are already there.
+ local cwd = [ PWD ] ;
+ local caller-location ;
+ if $(caller)
+ caller-location = [ binding $(caller) ] ;
+ caller-location = $(caller-location:D) ;
+ caller-location = [ normalize-raw-paths $(caller-location:R=$(cwd)) ] ;
+ local search = [ peek : BOOST_BUILD_PATH ] ;
+ search = [ normalize-raw-paths $(search:R=$(cwd)) ] ;
+ if $(caller-location) && ! $(caller-location) in $(search)
+ search = $(caller-location) $(search) ;
+ load $(m) : : $(search) ;
local all-rules = [ RULENAMES $(m) ] ;
# import all the rules with qualification
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