You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After enabling ASAN in the compiler project I work on, I noticed a strstr() call in the tokenization loop is responsible for significant slowdown in ASAN builds.
I believe this is worth reporting since it's a simple change that caused a huge diff, which should make an interesting case for profiling.
In the worst case, ASAN builds are about 170x slower on Skylake, 150x on Zen4, after replacing the strstr() with a loop it's back to normal 2.8x / 2.5x.
The change is fuhsnn/slimcc@eb66a46.
A reproduce script testing ASAN on-off and strstr() with-without, should work on any recent-ish glibc docker:
set -e
git clone https://github.com/fuhsnn/c_files
git clone https://github.com/fuhsnn/slimcc
cd slimcc
git checkout eb66a4619f168af7ce5c34ecc8cc37c82988d51d
cc *.c -o slimcc
echo "Asan 0, strstr 0"
time ./slimcc ../c_files/gcc.c -E -o/dev/null
cc *.c -o slimcc -fsanitize=address
echo "Asan 1 strstr 0"
time ./slimcc ../c_files/gcc.c -E -o/dev/null
git checkout HEAD~1
cc *.c -o slimcc
echo "Asan 0, strstr 1"
time ./slimcc ../c_files/gcc.c -E -o/dev/null
cc *.c -o slimcc -fsanitize=address
echo "Asan 1, strstr 1"
time ./slimcc ../c_files/gcc.c -E -o/dev/null
The text was updated successfully, but these errors were encountered:
After enabling ASAN in the compiler project I work on, I noticed a
strstr()
call in the tokenization loop is responsible for significant slowdown in ASAN builds.I believe this is worth reporting since it's a simple change that caused a huge diff, which should make an interesting case for profiling.
In the worst case, ASAN builds are about 170x slower on Skylake, 150x on Zen4, after replacing the
strstr()
with a loop it's back to normal 2.8x / 2.5x.The change is fuhsnn/slimcc@eb66a46.
A reproduce script testing ASAN on-off and
strstr()
with-without, should work on any recent-ish glibc docker:The text was updated successfully, but these errors were encountered: