cmList: Fix performance regression in Join / to_string
Refactoring in !8580 (merged) accidentally introduced unnecessary string copies and allocations. Remove unnecessary copies.
This seems to largely fix the regression initially discussed here. Comparing this commit (9620a30), master (083c6fd9) and the assumed parent of the regression (88e7ad00) on LLVM shows a return to normal on my machine.
$ git checkout 9620a3019de0984f29e0546f759a73680ee7ae5f
$ cmake . -B build/`git rev-parse HEAD` -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
$ cmake --build build/`git rev-parse HEAD`
$ git checkout 083c6fd927327e48a2f6e87431657e4c9c6c5108
$ cmake . -B build/`git rev-parse HEAD` -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
$ cmake --build build/`git rev-parse HEAD`
$ git checkout 88e7ad0084bd6a2fa6f032d7be1ee5d993440dcf
$ cmake . -B build/`git rev-parse HEAD` -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
$ cmake --build build/`git rev-parse HEAD`
$ rm -rf /tmp/experiment
$ hyperfine \
-L version 9620a3019de0984f29e0546f759a73680ee7ae5f,083c6fd927327e48a2f6e87431657e4c9c6c5108,88e7ad0084bd6a2fa6f032d7be1ee5d993440dcf \
--warmup 1 \
'~/cmake/build/{version}/bin/cmake ~/llvm-project/llvm -G Ninja -B /tmp/experiment -DCMAKE_BUILD_TYPE=Release' \
--cleanup 'rm -rf /tmp/experiment'
Command | Mean [s] | Min [s] | Max [s] | Relative |
---|---|---|---|---|
9620a3019de0984f29e0546f759a73680ee7ae5f |
12.020 ± 0.055 | 11.940 | 12.098 | 1.00 |
083c6fd927327e48a2f6e87431657e4c9c6c5108 |
66.225 ± 0.533 | 65.190 | 67.127 | 5.51 ± 0.05 |
88e7ad0084bd6a2fa6f032d7be1ee5d993440dcf |
12.042 ± 0.072 | 11.960 | 12.147 | 1.00 ± 0.01 |