2

Imagine you would like to rename the functions of an imported library and/or .dlls. An option is to wrap calls in a static class with the name convention of your choice like so:

In the imported library I have:

public static class Library {
    public static void LibMethod1(args...)
    public static void LibMethod2(args...)
    ...
}

To wrap this functions according to my new function call desires I can choose to do:

public static class Lib {
    public static void myNewName1(args...) {
        Library.LibMethod1(args...);  
    }
    public static void myNewName2(args...) {
        Library.LibMethod2(args...);
    }
    ...
}

So that I could change the way I called the methods all over my application
from: Library.LibMethod1(args...); To: Lib.myNewName1(args..)

This could be to have a new name API with calling names that are more understandable for the developer or the team or the specific use of the app, or to remove the c# pascal case naming convention for methods.

Does this have any overhead consequences/considerations in performance intensive applications (with render involved like game engines) where the wrapping can be done for lots of functions and lots of calls?
Asking only regarding the machine code execution performance, not regarding the programming/code maintenance overhead which is obvious.

rustyBucketBay
  • 4,320
  • 3
  • 17
  • 47
  • This might be useful: [Inline functions in C#?](https://stackoverflow.com/questions/473782/inline-functions-in-c) – Theodor Zoulias Apr 02 '22 at 10:09
  • thanks for comment @TheodorZoulias, that is indeed a useful read but I do not see very much the relation of function inlining and the compiler/Just-In-Time optimizer options with my question, in case there could be some options to be applied to the scenario of the question :) – rustyBucketBay Apr 02 '22 at 10:22
  • I am not an expert in these things, but my understanding is that when a method is inlined, the overhead of calling this method is eliminated. The compiler replaces the invocation of the method with the contents of the method, so it's like the method does not exist any more. – Theodor Zoulias Apr 02 '22 at 14:48
  • so you suggest that with the aggresive inline of the wrapped methods in case there could be any overhead, it could be gone, correct? – rustyBucketBay Apr 02 '22 at 14:54
  • Yes, exactly. That's the idea. – Theodor Zoulias Apr 02 '22 at 14:56

0 Answers0