Hey, folks! Newbie here. I have a project that takes a lot of time to do a simple cargo check. I believe that all libs already compiled, this test was made after a cargo build. I just add a blank line in main.rs then execute cargo check. This process takes more than a minute. I tested in a desktop i7 4790 Windows 10 (AV disabled) and a Lenovo L340L i7 9750h with Linux Fedora 31, both with SSD.
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| Item | Self time | % of total time | Time | Item count | Incremental load time | Incremental result hashing time |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| typeck | 58.04s | 72.137 | 60.88s | 82 | 12.31ms | 3.91ms |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| LLVM_module_codegen_emit_obj | 4.64s | 5.772 | 4.64s | 23 | 0.00ns | 0.00ns |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| run_linker | 4.23s | 5.260 | 4.23s | 1 | 0.00ns | 0.00ns |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| evaluate_obligation | 2.58s | 3.203 | 2.76s | 9256 | 0.00ns | 0.00ns |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| LLVM_passes | 1.65s | 2.049 | 1.65s | 1 | 0.00ns | 0.00ns |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| codegen_module | 1.48s | 1.845 | 1.98s | 22 | 0.00ns | 0.00ns |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| metadata_decode_entry_exported_symbols | 1.07s | 1.333 | 1.09s | 291 | 0.00ns | 0.00ns |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| expand_crate | 1.03s | 1.277 | 1.17s | 1 | 0.00ns | 0.00ns |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
| incr_comp_encode_dep_graph | 650.33ms | 0.808 | 650.33ms | 540550 | 0.00ns | 0.00ns |
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
...
+--------------------------------------------------+-----------+-----------------+----------+------------+-----------------------+---------------------------------+
Total cpu time: 80.4545914s
My first suspicion was the sqlx library that your macro connects to the database. But I enabled offline mode and the time hasn't changed. I enabled the use of sccache on Linux but it also improved nothing.
It seems that time stays in this step called "typeck". Does anyone have any suggestions on how I can improve this time?
--EDIT
Tested with
rustc 1.53
rustc 1.54
rustc 1.56.0-nightly
Thanks in advance!