2 ms·
Aren't non-inlined function calls in any language "slow"? I'm not seeing any details here, but as Swift is a compiled language with little support for runtime m
by TillE 11y ago
Aren't non-inlined function calls in any language "slow"? I'm not seeing any details here, but as Swift is a compiled language with little support for runtime monkey-patching, I assume it's not doing anything especially ridiculous with normal function calls.
- jerf 11y agoYou'd have to define "slow" before you can answer that. I say this not because Go is the epitome of speed, but merely because I happen to have the number on hand from recent testing: Go can call an interface method with no arguments and no return value in a tight loop in about 5 nanoseconds. Is that fast? Is that slow? Depends on your definition. On the machine in question that's about 15 cycles. That strikes me as pretty good in the broad sense, but certainly 15 cycles slower than an inlined call. (I'd like to compare it to a static function call but I haven't yet worked out how to write a static function call in such a way that I can run it in the profiler correctly but it doesn't inline down to nothing.)