[Bug c++/97094] New: Compiling big std::unordered_map<std::string, bool> became slower

a.morozov at drweb dot com gcc-bugzilla@gcc.gnu.org
Thu Sep 17 17:58:57 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97094

            Bug ID: 97094
           Summary: Compiling big std::unordered_map<std::string, bool>
                    became slower
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a.morozov at drweb dot com
  Target Milestone: ---

Make C++ code with big std::unordered_map<std::string, bool>:
$ cat str_map.cc
#include <string>
#include <unordered_map>
std::unordered_map<std::string, bool> m = {
#include "str.h"
};
$ find /usr/include | xargs -Iaaa echo '{"aaa", true},' >str.h
$ head -5 str.h
{"/usr/include", true},
{"/usr/include/syscall.h", true},
{"/usr/include/netash", true},
{"/usr/include/netash/ash.h", true},
{"/usr/include/lber.h", true},
$ wc -l str.h
6362 str.h

Compile it with different g++ versions:
$ time -p g++-9.3.0 -std=c++17 -c str_map.cc
real 6,35
user 5,96
sys 0,24
$ time -p g++-10.2.0 -std=c++17 -c str_map.cc
real 32,11
user 27,09
sys 2,32
10.2 is much slower than 9.3.

$ g++-9.3.0 -v
Using built-in specs.
COLLECT_GCC=g++-9.3.0
COLLECT_LTO_WRAPPER=/srv/projects/gcc/gcc-9.3.0-build/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --enable-languages=c,c++
--prefix=/srv/projects/gcc/gcc-9.3.0-build
Thread model: posix
gcc version 9.3.0 (GCC)
$ g++-10.2.0 -v
Using built-in specs.
COLLECT_GCC=g++-10.2.0
COLLECT_LTO_WRAPPER=/srv/projects/gcc/gcc-10.2.0-build/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --enable-languages=c,c++
--prefix=/srv/projects/gcc/gcc-10.2.0-build
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)


More information about the Gcc-bugs mailing list