intel / intel/llvm

Really slow compilation with large maps

Open
#17,041 2 comments 0 reactions 0 assignees View on GitHub
confirmed
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

Hello, I am experiencing a really slow compilation time with OneAPI 2024 on a single file which initializes some constant `unordered_map`s.

The source code is quite large (~4500 lines), so I just put it on [Compiler Explorer](https://godbolt.org/z/YzerMvh5Y).

The full command is this:
```bash
icpx -O1 -std=c++17 -fPIC -fno-fast-math -fsanitize=address,undefined -Wall -Wextra -pedantic -Wsign-conversion -Wfloat-conversion -Wfloat-equal -Wno-unknown-pragmas -Werror example.cpp -o example.x
```

Here are some compilation times measured with `time`.

OneAPI 2024.2.0.495:
```bash
real 16m51.163s
user 16m49.798s
sys 0m0.890s
```

OneAPI 2025.0.4.20:
```bash
real 15m40.380s
user 15m39.558s
sys 0m0.509s
```

clang++ 19.1.7:
```bash
real 0m39.850s
user 0m39.226s
sys 0m0.576s
```

I didn't measure the compilation time for g++ 14.2 but it surely is less than the time limit on Compiler Explorer as you can see [here](https://godbolt.org/z/Y43K8WT9G).

If it may be of any help, I also tried disabling optimizations and sanitizers and gathered these times:

| Flags | Time [s] |
|-------|----------|
| ` -O0` | ~12 |
| ` -O1` | ~47 |
| ` -O0 -fsanitize=address,undefined` | ~8 |

Contributor guide

Open the contributing guide

Research direction

Start with the Compiler Explorer reproducer linked in the issue and run the full icpx command against the reported OneAPI versions. Compare the behavior with clang++ and the listed optimization and sanitizer combinations to narrow the trigger. Done should include a confirmed diagnosis and a measured improvement or clearly documented limitation for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.