RFR: JDK-8213339 Update precompiled.hpp with headers based on current frequency
Erik Joelsson
erik.joelsson at oracle.com
Mon Nov 5 16:57:42 UTC 2018
On 2018-11-05 01:41, Magnus Ihse Bursie wrote:
> If I were to spend more time on PCH, I'd rather spend it on either
> Windows (which is the slowest build platform in our CI), or Solaris,
> which does not have precompiled headers at all. (I actually looked
> into solstudio PCH as part of this fix to see if the new set of
> headers would allow us to enable it. Unfortunately, it seems like they
> need a single PCH per directory of source code files (e.g. all files
> in share/logging can share PCH with each other, but they cannot share
> PCH with the files in share/utilities. As I understood the problem, at
> least; the error messages were unclear and undocumented.)
>
I looked into this before. There were several limitations that made it
very tricky. The compiler was extremely picky with command lines
matching, including something with directories, which is probably what
you describe (I don't remember well at this point). I managed to hack
around it to get some C++ files compiled with a PCH so I could get a
feel for the potential speedup. It seemed like the best gain I would get
was about 10% per compiled file. I did not think that was enough gain to
motivate the amount of hackery required to get it to actually work.
Looking inside the PCH from Solaris Studio, they were basically just
preprocessed header files, no binaries.
/Erik
> /Magnus
>
>>
>> Cheers,
>> David
>>
>>> Thanks, Thomas
>>>
>>>> That would also remove the problem of things not compiling with PCH
>>>> disabled as a single set of includes would be used for both PCH and
>>>> non-PCH building.
>>>>
>>>> I don't know if the other compilers support PCH in a similar manner
>>>> to gcc.
>>>>
>>>> Cheers,
>>>> David
>>>>
>>>>> /Magnus
>>>>>
>>>>>>
>>>>>> David
>>>>>>
>>>>>>> 25 // Precompiled headers are turned off for Sun Studio,
>>>>>>> May as well change to Solaris Studio if you're going to fix the
>>>>>>> typo :)
>>>>>>> Thanks.
>>>>>>> David
>>>>>>>> On 3/11/2018 7:06 PM, Magnus Ihse Bursie wrote:
>>>>>>>> The reasons for the current set of files included in
>>>>>>>> precompiled.hpp is somewhat lost in the mists of history.
>>>>>>>> However, it is clear that it is not optimal.
>>>>>>>>
>>>>>>>> This patch replaces the current set with a new set, based on
>>>>>>>> how often a header file is included in a C++ file. This
>>>>>>>> selection contains all header files that are included by at
>>>>>>>> least 130 C++ files. Testing has shown that this is around the
>>>>>>>> optimal value -- include many more, and too many "innocent"
>>>>>>>> files get hurt by unneeded work, leave out many more, and we
>>>>>>>> miss out on optimization possibilities.
>>>>>>>>
>>>>>>>> The same set turned out to work well for both clang and gcc.
>>>>>>>> However, files named "*.inline.hpp" did hurt rather than help
>>>>>>>> performance, so those have been left out. For visual studio,
>>>>>>>> the same set was also optimal, as long as the inline files were
>>>>>>>> included. Presumably, visual studio is better than gcc/clang on
>>>>>>>> handling precompiled headers containing inlined code.
>>>>>>>>
>>>>>>>> Here are some rough comparisons from our internal CI system,
>>>>>>>> for building the target "hotspot" from scratch.
>>>>>>>>
>>>>>>>> macosx-x64:
>>>>>>>> old: 00:05:00
>>>>>>>> new: 00:03:47
>>>>>>>>
>>>>>>>> linux-x64:
>>>>>>>> old: 00:05:43
>>>>>>>> new: 00:04:51
>>>>>>>>
>>>>>>>> windows-x64:
>>>>>>>> old: 00:05:18
>>>>>>>> new: 00:04:33
>>>>>>>>
>>>>>>>> linux-aarch64:
>>>>>>>> old: 00:07:57
>>>>>>>> new: 00:03:48
>>>>>>>>
>>>>>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8213339
>>>>>>>> WebRev:
>>>>>>>> http://cr.openjdk.java.net/~ihse/JDK-8213339-update-precompiled-headers/webrev.01
>>>>>>>>
>>>>>>>> /Magnus
>>>>>
>
More information about the build-dev
mailing list