Commit 435284e
committed
[PPC] Make assembler.cpp compile over 30 times faster
Clang was taking around 30 seconds to compile assembler.cpp on my
machine, with most of its time spent in code generation for the global
initializer for `lookup`.
Changing the map key from `std::string` to `std::string_view` drops
compile time to under a second. This is because the compiler no longer
has to code gen the allocation, initialization, and moves of 2,100
`std::string`s. `std::string_view` is effectively free to initialize in
comparison.
While I was here I made the map `static const`. It's not required for
the build time improvement, but it is more correct and helped me check
that no-one is mutating the map.1 parent 464dda7 commit 435284e
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
2932 | 2932 | | |
2933 | 2933 | | |
2934 | 2934 | | |
2935 | | - | |
| 2935 | + | |
| 2936 | + | |
2936 | 2937 | | |
2937 | 2938 | | |
2938 | 2939 | | |
2939 | 2940 | | |
2940 | | - | |
| 2941 | + | |
2941 | 2942 | | |
2942 | 2943 | | |
2943 | 2944 | | |
| |||
0 commit comments