3 ms·
> In a C library such callbacks cannot be inlined as it is compiled ahead of time. C compilers can do that with whole-program optimization: 1. Clone the funct
by astrange 12y ago
> In a C library such callbacks cannot be inlined as it is compiled ahead of time.
C compilers can do that with whole-program optimization:
1. Clone the function taking the callback, and set that parameter constant so the value of the callback is known.
2. Change the indirect calls to direct calls.
3. Inline the new direct calls.
Of course, the library has to be statically linked, but that's not a problem for scientific users.
Remember, if you optimize something yourself, just make friends with a compiler engineer and get them to add it!