Skip to content

Conversation

@paolopas
Copy link
Contributor

removed unnecessary declarations in engine headers results in 9% decreasing of compilation time and
roughly 17% decreasing of dependencies among sources.

Now you can think about cleaning up the individual sources from all unnecessary includes, and this should also bring several benefits.

removed unnecessary declarations in engine headers
results in 9% decreasing of compilation time and
roughly 17% decreasing of dependencies among sources
removed unnecessary declarations in engine headers
results in 9% decreasing of compilation time and
roughly 17% decreasing of dependencies among sources
Copy link
Member

@grafikrobot grafikrobot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't want to duplicate declarations in multiple places. I will trade slower compiles to avoid the duplication. Especially as the duplication makes it harder to refactor. I'm good for other header cleanups though.

@grafikrobot
Copy link
Member

Continuing to think about this.. Maybe we can have a single jam_fwd.h header that has the various engine declarations. I think I can live with having the types declared two times (as opposed to declared in a bunch of places).

@paolopas
Copy link
Contributor Author

The reason for this work is not to seek faster compilation, I solved that with a Makefile; the reason is that if you want to clean up the sources you have to start by doing it in the headers.

@grafikrobot
Copy link
Member

I solved that with a Makefile

How so?

@paolopas
Copy link
Contributor Author

paolopas commented Jan 31, 2026

During development it is common to make small changes, if every time I launch bootstrap.sh to recompile I have to wait 6m30s it is clear that I should look for an alternative method to recompile b2. Specifically, I wrote a script that extracts the source list from build.bat, generates dependencies (g++ -M...) in the engine directory, and assembles a makefile that I then use to work (And here's the explanation for #531 too.) It uses too many Linux programs to be portable but if you're interested in I'll attach it somewhere.
With this makefile I was able to create this PR in just one day of work and it also allowed me to compute the reduction in dependencies obtained at the source level by approximately measuring the size of the dependencies file produced by the script (g++ -M..), for the compilation time I am now around 6m (I understand that this time is not reliable.)

But I don't think that's the point here.

Your jam_fwd.h idea sounds good to me, if you decide to go that way I can implement it, it would be a really small header anyway. Otherwise I just wasted another day... (ah ah)

@grafikrobot
Copy link
Member

An FYI regarding using make.. For usual b2 development you can build b2 with b2 to get incremental building and all the additional build variants, like sanitized build. The bootstrap is solely for regular users. For example you can:

cd root
./src/engine/build.sh
./src/engine/b2 b2
cd test
B2=${PWD}/../.build/gcc-*/cxxstd-11-iso/threading-mujlti-b2 ./test_all.py gcc

Which will give you a debug b2, that you can run in a debugger also. And you can run the regular tests with it. Although most times I just install a stable b2 to my home dir (i.e. ./b2 install --prefix=${HOME}/.local) and just use that for building b2 (b2 b2).

@paolopas paolopas mentioned this pull request Jan 31, 2026
@paolopas
Copy link
Contributor Author

Continue on #540 with the requested changes?

@paolopas paolopas closed this Jan 31, 2026
@paolopas paolopas deleted the gnurant-2 branch February 1, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants