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

--- Comment #6 from Qing Zhao <qing.zhao at oracle dot com> ---
(A correction to comment 4:

when adding #include <string.h>, the call to strcmp(s, "a") was inlined by
glibc in the header

with the latest upstream GCC
)


with attached testing case, on GCC farm machine gcc116, I got the following
run-time performance data:

qinzhao@gcc116:~/Bugs/78809/const_cmp$ sh t_p
/home/qinzhao/Install/latest/bin/gcc -O2 t_p_1.c t_p.c -DINLINED
inlined version
41.67user 0.00system 0:41.67elapsed 99%CPU (0avgtext+0avgdata 360maxresident)k
0inputs+0outputs (0major+135minor)pagefaults 0swaps
/home/qinzhao/Install/latest/bin/gcc -O2 t_p_1.c t_p.c
non-inlined version
20.84user 0.00system 0:20.83elapsed 100%CPU (0avgtext+0avgdata 360maxresident)k
0inputs+0outputs (0major+135minor)pagefaults 0swaps

>From the data, we can see the inlined version of strcmp (by glibc) is much
slower than the direct call to strcmp.  (this is for size 2)
I am using GCC farm machine gcc116:

qinzhao@gcc116:~/Bugs/78809/const_cmp$ uname -a
Linux gcc116 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:45:34 UTC 2016
aarch64 aarch64 aarch64 GNU/Linux

Reply via email to