yosupo06 / library-checker-judge

https://judge.yosupo.jp/
Apache License 2.0
41 stars 22 forks source link

C++の実行が一部のコードで昔より遅い #363

Closed yosupo06 closed 11 months ago

yosupo06 commented 11 months ago

https://judge.yosupo.jp/submission/48200 たとえばこれなど

ジャッジサーバー上で色々実験したところ、

という感じだった。コンパイラかライブラリに原因がありそう?

yosupo06 commented 11 months ago

docker使わず

$ g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ B.cpp -O2 -o main -march=native -std=c++20
$ ldd main
        linux-vdso.so.1 (0x00007ffdb9091000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x0000152e43a00000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x0000152e4467e000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000152e43600000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000152e43d19000)
        /lib64/ld-linux-x86-64.so.2 (0x0000152e446a6000)

docker(library-checker-images-gcc)

$ g++ --version
g++ (GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU
$ ldd main
        linux-vdso.so.1 (0x00007ffd8dbe9000)
        libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 (0x00007fc3a662c000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc3a64e8000)
        libgcc_s.so.1 => /usr/local/lib64/libgcc_s.so.1 (0x00007fc3a64c7000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc3a6302000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fc3a685a000)
yosupo06 commented 11 months ago

gccのバージョン問題っぽい?gcc:12.1ではなくてgcc:11.4を使ったら速くなった