Hey everyone,
Although I'm a student again, I don't really have the time or chops to apply for GSoC, at least not this year. I was randomly looking up things the other day though when I came across precompiled headers. I don't remember seeing any sight of them when I studied wine code in the past, and all I found on the mailing list was this: https://www.winehq.org/pipermail/wine-devel/2004-July/027933.html
It might not be a hard-enough task to warrant a GSoC grant, and I don't know enough about the details to add an entry to the wiki (Would precompiled headers work for wine? Does wine actually use them already?) I just thought I would mention it because if it makes sense for the project, it might be an interesting change with a big payoff for build times.
Kyle
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-02-13 um 00:05 schrieb Kyle Auble:
Hey everyone,
Although I'm a student again, I don't really have the time or chops to apply for GSoC, at least not this year. I was randomly looking up things the other day though when I came across precompiled headers. I don't remember seeing any sight of them when I studied wine code in the past, and all I found on the mailing list was this: https://www.winehq.org/pipermail/wine-devel/2004-July/027933.html
I guess a good starting point would be to compare the impact of precompiled headers to ccache. My guess is that everyone who wants fast compiles uses ccache these days.
Am 14.02.2016 um 19:25 schrieb Stefan Dösinger:
I guess a good starting point would be to compare the impact of precompiled headers to ccache. My guess is that everyone who wants fast compiles uses ccache these days.
Precompiled headers can already improve the performance during the first compilation unlike ccache which would rather slow it down. This could for example reduce the build time on our build servers.
ReactOS uses precompiled header files and they suggested us multiple time to also use them in Wine Staging as it reduces the build time a lot according to their experience.
On 02/14/2016 12:15 PM, Michael Müller wrote:
Am 14.02.2016 um 19:25 schrieb Stefan Dösinger:
I guess a good starting point would be to compare the impact of precompiled headers to ccache. My guess is that everyone who wants fast compiles uses ccache these days.
Precompiled headers can already improve the performance during the first compilation unlike ccache which would rather slow it down. This could for example reduce the build time on our build servers.
ReactOS uses precompiled header files and they suggested us multiple time to also use them in Wine Staging as it reduces the build time a lot according to their experience.
Thanks for the feedback; I didn't think about ccache, but that might be because I've honestly had mixed results with it in the past.
It's been several months so I could be completely misremembering, but I want to say ccache didn't seem to help even subsequent builds of wine on my system (which has really old hardware). Just keeping the object files for make (which is a no-go for final tests) seemed to make a much bigger difference. At the same time, ccache did a great job speeding up builds of the linux kernel. Of course, these are all vague memories so I could just be forgetting if I finally got ccache working well for wine.
That said, if I understand the precompiled headers correctly, they're orthogonal to the caching that make and ccache do. While those check for compilations that haven't changed and load results from the cache, the precompiled headers let the compiler bypass much of the processing for #include-s when it does have to run.
From what little I've read, it doesn't seem like it would be too hard to add the necessary changes to the make files. The main problem I could picture is that different compilers might all take a different approach, though the only difference for clang seems to be that it uses ".pch" instead of ".gch" as the file extension.
Kyle
On Sun, 14 Feb 2016, Kyle Auble wrote: [...]
It's been several months so I could be completely misremembering, but I want to say ccache didn't seem to help even subsequent builds of wine on my system (which has really old hardware). Just keeping the object files for make (which is a no-go for final tests) seemed to make a much bigger difference.
Not sure why keeping the object files would be a no-go (at least for preprocessor mode).
However, note that nowadays ccache has two modes: * 'Preprocessor mode' where where ccache runs the preprocessor on the source code and hashes the result to find the object file in its cache.
* 'Direct mode' where ccache hashes the source code and include files directly which lets it skip the preprocessor step too. There's a catch in this mode which is that creating a new header file may change the code that would be compiled, without ccache detecting it.
Direct mode should improve compilation times at least as much as precompiled headers.
On 02/15/2016 04:19 PM, Francois Gouget wrote:
On Sun, 14 Feb 2016, Kyle Auble wrote: [...]
It's been several months so I could be completely misremembering, but I want to say ccache didn't seem to help even subsequent builds of wine on my system (which has really old hardware). Just keeping the object files for make (which is a no-go for final tests) seemed to make a much bigger difference.
Not sure why keeping the object files would be a no-go (at least for preprocessor mode).
Oh, that's not to avoid a problem with ccache but for doing the build from a clean directory.
However, note that nowadays ccache has two modes:
'Preprocessor mode' where where ccache runs the preprocessor on the source code and hashes the result to find the object file in its cache.
'Direct mode' where ccache hashes the source code and include files directly which lets it skip the preprocessor step too. There's a catch in this mode which is that creating a new header file may change the code that would be compiled, without ccache detecting it.
Direct mode should improve compilation times at least as much as precompiled headers.
That's true, I noticed in the ccache stats that I would get occasional preprocess hits when building the linux kernel. The more I think about it, I wonder if ccache might seem less effective for me because my processor struggles some with the hashing. Since I don't remember exactly how my stats turned out, I'd be willing to figure out the precompiled headers, then test if they make a difference on top of ccache. If they seem worth it and it's still an open issue, I can submit the necessary patches; I just can't promise it will happen soon.
Kyle
Am 16.02.2016 um 06:05 schrieb Kyle Auble:
On 02/15/2016 04:19 PM, Francois Gouget wrote:
On Sun, 14 Feb 2016, Kyle Auble wrote: [...]
A small patch as a starting point (has multiple issues, e.g. dependency problems, thus the 2>/dev/null)
diff --git a/tools/makedep.c b/tools/makedep.c index 9fd704b..c6b4243 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -2266,7 +2266,11 @@ static struct strarray output_sources( const struct makefile *make ) output_filenames( extradefs ); output_filenames( get_expanded_make_var_array( make, "EXTRAIDLFLAGS" )); output_filename( source->filename ); - output( "\n" ); + output( "\n\t$(CC) $@" ); + output_filenames( includes ); + output_filenames( make->define_args ); + output_filenames( extradefs ); + output( " 2>/dev/null || true\n" ); output_filenames_obj_dir( make, targets ); output( ": %s", source->filename ); output_filenames( dependencies );