I modified your test program a bit (to measure time from it, see
attached), tried with -O{2,3,s}, and except -Os I always have better
results with the "optimized" version, eg:$ ./a-O3.out 0 150000000 xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa 0 <string.h> (nb=150000000, len=0) time = 8.424984 : res = 0 $ ./a-O3.out 1 150000000 xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa 0 Optimized (nb=150000000, len=0) time = 8.212137 : res = 0 Possibly gcc (v4.4.5 here) is clever enough to optimize/inline/cheat when given standard (no custom) code, since I had similar results than yours with the original test.c... How does this one work with gcc-5.2? On Mon, Nov 23, 2015 at 10:07 PM, Marion & Christophe JAILLET <[email protected]> wrote: > I just made a small application which takes as command line parameters the > number of iteration to run, which version of the algorithm to use, the 2 > strings to compare and the length to compare (or 0 for the non 'n' versions) > > > Compiled using > gcc -O3 test.c > > Tested using > linux:~/Code_Source$ time ./a.out 1 100000000 > xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa > xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa 0 > Optimized (nb=100000000, len=0) > res = 0 > > real 0m4.193s > user 0m4.192s > sys 0m0.000s > > > > linux:~/Code_Source$ time ./a.out 0 100000000 > xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa > xcxcxcxcxcxcxcxcxcxcwwwwwwwwwwaaaaaaaaaa 0 > <string.h> (nb=100000000, len=0) > res = 0 > > real 0m1.708s > user 0m1.704s > sys 0m0.000s > > > > > See atatchement. > > CJ > > > > Le 23/11/2015 21:33, Yann Ylavic a écrit : >> >> Hi Christophe, >> >> On Mon, Nov 23, 2015 at 9:12 PM, Christophe JAILLET >> <[email protected]> wrote: >>> >>> I tried to do some but the benefit of the optimized version is not that >>> clear, at least on my system: >>> gcc 5.2.1 >>> Linux linux 4.2.0-18-generic #22-Ubuntu SMP Fri Nov 6 18:25:50 UTC >>> 2015 >>> x86_64 x86_64 x86_64 GNU/Linux >> >> Unfortunately, gcc 5.2.1 (i.e. latest compilers' versions) are not >> widely used... >> >> Did you try a code like ap_proxy_port_of_scheme() with values which >> are unknown schemes? >> Or even worse cases, with similarly chained strcasecmp() looking for >> eg. "httpx" in something like {"httpa", "httpb", "httpc", ..., >> "httpw"}? >> >> Regards, >> Yann. >> >
