public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97094] New: Compiling big std::unordered_map<std::string, bool> became slower
@ 2020-09-17 17:58 a.morozov at drweb dot com
  2020-09-18  6:12 ` [Bug c++/97094] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: a.morozov at drweb dot com @ 2020-09-17 17:58 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/97094] Compiling big std::unordered_map<std::string, bool> became slower
  2020-09-17 17:58 [Bug c++/97094] New: Compiling big std::unordered_map<std::string, bool> became slower a.morozov at drweb dot com
@ 2020-09-18  6:12 ` rguenth at gcc dot gnu.org
  2020-09-18 11:45 ` a.morozov at drweb dot com
  2020-09-28 14:01 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-18  6:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Can you try to specify an explicit -std=c++xy?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/97094] Compiling big std::unordered_map<std::string, bool> became slower
  2020-09-17 17:58 [Bug c++/97094] New: Compiling big std::unordered_map<std::string, bool> became slower a.morozov at drweb dot com
  2020-09-18  6:12 ` [Bug c++/97094] " rguenth at gcc dot gnu.org
@ 2020-09-18 11:45 ` a.morozov at drweb dot com
  2020-09-28 14:01 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: a.morozov at drweb dot com @ 2020-09-18 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Alexander Morozov <a.morozov at drweb dot com> ---
$ g++-9.3.0 -v -std=c++17
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 -std=c++17
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)

Also tried 11.0.0 20200913. The result does not look better:
$ time -p g++-9.3.0 -std=c++17 -c str_map.cc
real 6,64
user 6,06
sys 0,22
$ time -p g++-11 -std=c++17 -c str_map.cc
real 68,83
user 62,11
sys 2,76

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/97094] Compiling big std::unordered_map<std::string, bool> became slower
  2020-09-17 17:58 [Bug c++/97094] New: Compiling big std::unordered_map<std::string, bool> became slower a.morozov at drweb dot com
  2020-09-18  6:12 ` [Bug c++/97094] " rguenth at gcc dot gnu.org
  2020-09-18 11:45 ` a.morozov at drweb dot com
@ 2020-09-28 14:01 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-09-28 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
With GCC 10/11, according to -ftime-report most of the time/memory usage is
from


tree eh                            :   1.10 ( 40%)   0.18 ( 31%)   1.29 ( 38%) 
642338 kB ( 84%)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-28 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 17:58 [Bug c++/97094] New: Compiling big std::unordered_map<std::string, bool> became slower a.morozov at drweb dot com
2020-09-18  6:12 ` [Bug c++/97094] " rguenth at gcc dot gnu.org
2020-09-18 11:45 ` a.morozov at drweb dot com
2020-09-28 14:01 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).