This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mon, Sep 13, 2004 at 12:15:13PM -0500, Benjamin Kosnik wrote: > > >This is slower than gcc-3.4.1. Percentage difference between each > >slot on the gcc-3.4.1 table and gcc-4.0.0 table: > > > > -4.867% -15.324% -8.733% -15.224% -13.925% -2.035% > > -4.995% -4.872% -7.592% -9.126% -3.582% -6.545% > > -11.423% -6.209% 9.218% -5.644% --3.759% -0.530% > > > >This seems fairly significant to me. > > I see this too. If you switch from __common_pool_policy to > __per_type_pool_policy it should go away, due to improved inlining. Ahh, by using __mt_alloc<type, __per_type_pool_policy>, I suppose. Hmmmm... I'm not sure how practical this will be unless I can easily configure the compiler with that as the default allocator. > I'd > like to elaborate on this, but before I do can I get your test program? > I don't see it in any of the posts. Yes, of course. It was depending on some support libraries, but I've separated the essence of the timing test and made it standalone. Sorry for it being a bit sloppy, but it's attached. Oh, and there's no deep theoretical basis for the algorithm :) I'm just trying to similate _some_ usage to get a metric. It's using clock_gettime() for the timing, so on Linux, add -lt, and on Solaris, add -lposix4. There is no good reason for this. > You can force single threaded behavior, even from threads enabled > configs in the current mt_alloc sources. Gotcha. I still think it's odd that the performance hit would be so dramatic just by using the thread-aware pool. Here are some new runs with the attached standalone test. The compiler is the same and the configure options are the same except for the --enable-threads selection. Configured with: ../../gcc-4.0.0/configure --with-dwarf2 --enable-languages=c,c++ --enable-threads=yes --disable-shared --prefix=/hosts/bubbles/spencer/devel/gcc/install-threaded/gcc-4.0.0-cross/sparc-sun-solaris2.8 --with-gnu-as --with-gnu-ld --disable-multilib --enable-concept-checks --enable-clocale=generic --enable-libstdcxx-allocator=mt --target=sparc-sun-solaris2.8 --with-sysroot=/opt/sysroot/sparc-sun-solaris2.8/ Thread model: posix gcc version 4.0.0 20040912 (experimental) Number of slots Size 1 8 64 1024 8192 1048576 ---------- ------- ------- ------- ------- ------- ------- 8 bytes 0.65408 0.74944 0.83358 0.74248 0.76384 0.79638 128 bytes 0.75224 0.88115 1.0066 0.92986 1.0087 1.0435 1024 bytes 0.89352 0.9052 0.91799 0.90635 0.90713 1.2161 Configured with: ../../gcc-4.0.0/configure --with-dwarf2 --enable-languages=c,c++ --enable-threads=no --disable-shared --prefix=/hosts/bubbles/spencer/devel/gcc/install/gcc-4.0.0-cross/sparc-sun-solaris2.8 --with-gnu-as --with-gnu-ld --disable-multilib --enable-concept-checks --enable-clocale=generic --enable-libstdcxx-allocator=mt --target=sparc-sun-solaris2.8 --with-sysroot=/opt/sysroot/sparc-sun-solaris2.8/ Thread model: single gcc version 4.0.0 20040912 (experimental) Number of slots Size 1 8 64 1024 8192 1048576 ---------- ------- ------- ------- ------- ------- ------- 8 bytes 2.4847 2.1741 2.3043 2.1742 1.9974 1.9253 128 bytes 3.5108 3.0202 2.9637 2.5956 2.6348 2.205 1024 bytes 0.87176 0.90735 0.94823 0.93351 0.94565 1.1434 I profiled the theaded version, and it's showing the top three "non-framework" functions as __gnu_cxx::__pool<(bool)1>::_M_reclaim_memory(char*, unsigned) __gnu_cxx::__mt_alloc<char, __gnu_cxx::__common_pool_policy<(bool)1> >::allocate(unsigned, void const*) __gnu_cxx::__pool<(bool)1>::_M_get_thread_id() [BTW, thanks for pointing out that those were forward declarations in the other post ;) Doh!] -- ------------------------------------------------------------------ Brad Spencer - spencer@infointeractive.com - "It's quite nice..." Systems Architect | InfoInterActive Corp. | A Canadian AOL Company
Attachment:
test_allocator_standalone.cc
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |