<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61447>61447</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [C++20] [Modules] Writing PCM will be unexpectedly slow with additional import.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:modules
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ChuanqiXu9
      </td>
    </tr>
</table>

<pre>
    We can find the reproducer at: https://discourse.llvm.org/t/modules-increased-build-times/68755/7

For short:

```
// test.cppm
module;

#include <iostream>

export module test;
import vulkan; // Vulcan is constructed big module.
```

will take 3~4s to generate the pcm.

And

```
module;
#include <iostream>
export module test.without.import;
```

will take about 0.5s to complete only.

Note that:

```
#include <iostream>
import vulkan;
```

will take 0.5s to complete too.

Currently I located in `ASTWriter::WriteDecl`. But I am not sure if this can be fixed simply.


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVEtv8zYQ_DXUZWGBJiXZOujgRwXkkKJAi6ZXilxLbChS5SOJL_3thWQjiZPC3wcYtESRszP7GBGC7i1iQ8o9KY-ZSHFwvjkMSdh_9F-pzjqnzs0TghQWTtoqiAOCx8k7lSR6EJHwHQwxToHwHWEtYa3SQbrkA-bGvIy58z1hbSSsHZ1KBsNKW-lRBFSrLmmjVlGPGAhrq-2mLAlrN4QeCd1d1tZ5CIPzc6DP-6Si19_ldQkNEUPM5TSNl91LRML3NzcZ11aapBAIP2gXokcxEv7L50P4Njkf4QKwwL6j6HH59JLMs7CE7-Ea-89k5jTpANLZEH2SERV0ur-i5P9PfFlftTEQxTMC_7cIEB30aNGLiEvGJznmn4_vrLqTi6-q7-v9rjR_1XFwKeYXpR9A95mLzqUINC8X_tKNk8GI4Kw535D_1S2qxA8repf21yr8FMVv5KJzN9wOyXu00ZzhAYyTYq6gtkAquvv9jyevI_qZNd8tz0eUhlQ0h32K8ABiBOsihOQR9AniMLeCsNAhnPQbKgh6nL4kI1MNVzWvRYbNutps63JdsCIbmnpDiw5PtViLknOU63LbFR3WkhZqyyqW6YZRxilfV3TDeFHkZUVZjVjRNZ629UaRguIotHkfw0yHkLCp1kWxyYzo0IRl8hmTRtie8GvnBMLYbAe-mW-uutQHUlCjQwwfWFFHsxjHgbA9YXtGSXkEUu4frxjlEeYkadvDb4dHWIrQISSLbxPOo2HOEIx7hbnbQCilo3ZWGLhUNs-SN82ts_Q6DqnLpRsJa2cm17_V5N3fKGePWSQuZjKr_C8AAP__x2N6yw">