plasma-umass / cwhy

"See why!" Explains and suggests fixes for compile-time errors for C, C++, C#, Go, Java, LaTeX, PHP, Python, Ruby, Rust, and TypeScript
Apache License 2.0
273 stars 6 forks source link

Wrapper mode is slow even when disabled #52

Closed nicovank closed 7 months ago

nicovank commented 7 months ago

Opening this issue just for tracking.

The overhead for the wrapper is somewhat significant (even with CWHY_DISABLE=1). It can make configure time longer. We should look and see if we can improve it. Maybe reduce imports, or move over from Python to Bash.

nicovank commented 7 months ago

Very much improved with aebbe491aaa66cdb2e8c8bacfef9f678fe8d00ac.

Performance measurements on Fleetwood (M1) through an Ubuntu docker image:

# No CWhy at all.
% hyperfine --prepare "rm -rf build" "cmake llvm -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc"
  Time (mean ± σ):     12.955 s ±  0.669 s    [User: 8.755 s, System: 4.557 s]
  Range (min … max):   12.338 s … 14.450 s    10 runs

# CWhy prior to improvement.
% hyperfine --prepare "rm -rf build" "env CWHY_DISABLE=1 cmake llvm -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=`cwhy --wrapper --- g++` -DCMAKE_C_COMPILER=`cwhy --wrapper --- gcc`"
  Time (mean ± σ):     82.146 s ±  1.522 s    [User: 72.262 s, System: 10.248 s]
  Range (min … max):   79.812 s … 84.497 s    10 runs

# CWhy post improvement.
% hyperfine --prepare "rm -rf build" "env CWHY_DISABLE=1 cmake llvm -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=`cwhy --wrapper --- g++` -DCMAKE_C_COMPILER=`cwhy --wrapper --- gcc`"
  Time (mean ± σ):     15.014 s ±  0.371 s    [User: 10.724 s, System: 4.635 s]
  Range (min … max):   14.412 s … 15.567 s    10 runs