The __fastcall, necessary or not?

Asked

Viewed 144 times

7

What is the usefulness of using __fastcall in the C function call++?

1 answer

5


Most of the time the calling convention is not considerable. When using the convention fastcall, the first arguments are passed through standard call registers.

In functions too succinct or that are called at a single point of the entire program, it is best to implement inline with its consequent optimizations, which even results in runtime calls. In other cases, it depends on many factors, such as the location of the data before, during and after the call. There are for example, machine instructions that require the input data in specific registers (such as mul, imul, div and idiv) and it is good that the call convention used favors this.

If you need extreme performance and can measure with sufficient accuracy, which is difficult, you can try it to see if it pays off. The gain can be derisory and it is often necessary to make adaptations that undermine the code. On some architectures, even trying to use it is common for modern architectures to be slower than other call conventions, making use rare.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.