This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: unexpected speedup by manual inlining
Rohit Garg wrote:
> Hi all,
>
> I have a small app. In it in a a particular place, I had a 2-3
> functions being called from one main function. They were small
> functions (5-6 lines) and inline keyword was used. The performance was
> ......... HORRIBLE.
>
> -Winline didn't report any case of a function not being inlined.
>
> I didn't know where to start. So I manually inlined these functions.
> They are very small and quite trivial. The program now shows ~60x
> speed-up in that part of the code. I have no idea what's the cause of
> this dramatic speed up. But I suspect it is because I am using g++ to
> make a shared library. All the functions referred to here are in one
> file. It is complied by using a -c -fPIC option to make a .o file.
> Several .o files are later packed together into a .so file using a
> -shared option.
60x? I wouldn't have thought so. I guess it's possible that inlining
reveals things that the optimizer wouldn't otherwise see. I can't
understand why the function wasn't inlined either. We'd have to see an
example.
Andrew.