What is the cost of a function call?

后端 未结 15 774
天命终不由人
天命终不由人 2020-12-12 22:34

Compared to

  • Simple memory access
  • Disk access
  • Memory access on another computer(on the same network)
  • Disk access on another computer
15条回答
  •  遥遥无期
    2020-12-12 23:10

    The cost of a function call depends on the architecture. x86 is considerably slower (a few clocks plus a clock or so per function argument) while 64-bit is much less because most function arguments are passed in registers instead of on the stack.

提交回复
热议问题