|
From: Lachlan A. <lac...@ip...> - 2003-02-02 08:19:52
|
On Sunday 02 February 2003 11:35, Neal Richter wrote: > very few of our > inline functions end up getting inlined. I've done a fair bit of > work with gprof and looking at what functions are actually inlined > in the assembly. At least with -O2 I'm not seeing some of them > making it. What version of gcc are you using? I've just compiled using 3.1,=20 and it seems to be inlining. For example, the copy constructor gives=20 the output below, which clearly shows line 229 of htString.h being=20 inlined. =09.align 2 =09.p2align 4,,15 =2Eglobl _ZN6StringC2ERKS_ =09.type=09_ZN6StringC2ERKS_,@function _ZN6StringC2ERKS_: =2ELFB7: =09.loc 1 67 0 =09pushl=09%ebp =2ELCFI34: =09movl=09%esp, %ebp =2ELCFI35: =09pushl=09%ebx =2ELCFI36: =09pushl=09%edx =09call=09.L31 =2EL31: =09popl=09%ebx =09addl=09$_GLOBAL_OFFSET_TABLE_+[.-.L31], %ebx =09movl=098(%ebp), %edx =09movl=0912(%ebp), %ecx =2ELBB10: =09movl=09_ZTV6String@GOT(%ebx), %eax =09addl=09$8, %eax =09.loc 1 68 0 =09movl=09$0, 4(%edx) =09.loc 1 67 0 =09movl=09%eax, (%edx) =09.file 38 "htString.h" =09.loc 38 229 0 =2ELBB11: =2ELBB12: =09movl=094(%ecx), %eax =09.loc 1 68 0 =2ELBE12: =2ELBE11: =09movl=09$0, 8(%edx) =09.loc 1 69 0 =09movl=09$0, 12(%edx) =09.loc 38 229 0 =09testl=09%eax, %eax =09jle=09.L25 =09pushl=09%eax =09pushl=09%eax =09movl=0912(%ecx), %eax =09pushl=09%eax =09pushl=09%edx =2ELCFI37: =09call=09_ZN6String4copyEPKcii@PLT =09addl=09$16, %esp =09.loc 1 73 0 =2EL25: =2ELBE10: =09movl=09-4(%ebp), %ebx =09movl=09%ebp, %esp =09popl=09%ebp =09ret =2ELFE7: =2ELfe7: =09.size=09_ZN6StringC2ERKS_,.Lfe7-_ZN6StringC2ERKS_ This isn't from DDD, but using the command /bin/sh ../libtool --mode=3Dcompile g++ -DHAVE_CONFIG_H -I. -I.=20 -I../include=20 -DDEFAULT_CONFIG_FILE=3D\"/home/lha/devel/htdig/install//conf/htdig.conf\= " =20 -I../include -I../htlib -I../htnet -I../htcommon =20 -I../htword -I../db -I../db =20 -I/usr/include -g -O2 -Wall -fno-rtti -fno-exceptions -S String.cc which is what my makefile generates, but with '-c' replaced by '-S'. > My next set of changes are going to be enhancements to WordDB, & > WordKey. These sound like good improvements. However when I do a dig of my=20 local computer, it seems rather disk bound, with CPU usage hovering=20 around 50%, of which a lot is system time. I haven't yet checked how=20 much of this is reading the input docs and how much is database=20 access, but my guess is that implementing your more compact database=20 format will give more bang for your development buck. It has the=20 added advantages that it uses less disk space, and that it speeds up=20 searching (assuming that is also disk bound). However, I am really=20 keen to get 3.2.0b5 out and I personally won't be working on=20 optimisations until then. Thoughts? > I need to get more familiar with how gcc does some of these > optimizations.. but at the same time I'm inclined not to rely on it > too much. Agreed. We should eliminate unnecessary function calls, but *some*=20 will still be needed, and we might as well get those inlined. Cheers, Lachlan |