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

            Bug ID: 120175
           Summary: Performance: compiling a program with using a library
                    slows other code.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: newbie-02 at gmx dot de
  Target Milestone: ---

hello @ all,  

again stumbled on an exotic issue, and again can't tell if gcc or glibc or "me
bad" which is always an option. If wrong asked here please move or point where
to put.   

I'm working on a project about datatype performance, where the idea came up to
put simple functions in a library for easy portability.  

Issue: once anything is compiled using any flavor of library the "normal"
direct calls to functions slow down by factor 5. That renders performance
comparison useless.  

E.g. 1000 times "x1d = NAN" takes about 1000 "readtsc()" ticks on my machine if
the program doesn't use libraries. Putting the same call in a library it works
the same and needs about 5000 ticks for 1000 iterations, I see that as overhead
which might be a topic for another day.  

However once any library compilation is active also the normal direct calls of
that statement in the main section slow down to ~5000 ticks ... unexpected and
unwanted.  

I did build some testcases, you find them at  
https://gitlab.gnome.org/newbie-02/dec_perf/-/tree/main/performance_breakdown_reg_libraries
 
and  
https://codereview.stackexchange.com/questions/296057/direct-calls-of-simple-functions-e-g-set-a-variable-to-nan-or-inf-become-slow?noredirect=1#comment591096_296057
 

Since I couldn't find any useful information on the web, even anonchatGPT is at
a loss, and CR/SE and SO are more or less bogged down in wording issues (which
also means that no one could put their finger on the problem right away), I
take the liberty of asking a supplementary question here, although I normally
don't like cross site posting.  

--------------------------------------------------------------------  
Spontaneous idea while writing this ... is there any optimization active which
looks for similar commands and merges them together? And in this case doesn't
prefer to use the direct call but the library function with it's overhead?
That's just newbie guessing, forget if silly and another explanation is around. 
--------------------------------------------------------------------  

Environment: linux ( recent debian ), gcc (Debian 14.2.0-16) 14.2.0   

TIA for any help

Reply via email to