考虑到:
Microsoft Specific
The __fastcall calling convention specifies that arguments to functions are to be passed in registers, when possible. The following list shows the implementation of this calling convention.
寄存器中的读/写时间比堆栈中的读/写时间快得多,我们在 C# 中是否有任何 __fastcall 等效项?
最佳答案
不是直接的,C# 主要使用等同于 MSVC++ 的 __stdcall 约定的内容。然而,它可以是“固定的”,尽管在 relatively dirty way 中。 (请注意,该示例适用于 __cdecl)。
不过,这可能是最好的方式。在像 C# 这样的高级语言中(哎呀,即使在大多数 C++ 程序中),这是留给编译器的最佳优化。强制调用约定通常可以 make things worse .即使它有帮助,它通常也不会给你带来太多好处,至少在我使用它的 C 和 C++ 程序中是这样。
关于c# - __c# 中的 fastcall 约定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4916738/