3 ms·
> C doesn't even have anything like that, you only get straight calls. C does have function pointers. But because it involves setting up and tearing down call
by vardump 11y ago
> C doesn't even have anything like that, you only get straight calls.
C does have function pointers. But because it involves setting up and tearing down call frame, they're slow for calling small functions large number of times. Functionally equivalent to C++ virtual calls (through vtable).
At least golang 1.2/1.3 did occasionally generate excessive number of bound checks. Once I counted no less than 6 nearly equivalent bound checks in an inner loop. It took a while of twiddling with code to get rid of all but 2.
However, mostly golang performance is pretty good. I like the language, so I just rather write a C/SSE/AVX library if I really need something to be very fast.
- klauspost 11y agoI like the language, so I just rather write a C/SSE/AVX library if I really need something to be very fast. I feel exactly the same, and once you get to know the quirks of the Go assembler it is actually pretty easy to use. That said unless I know it can be done en SSE, I usually don't bother, because the speedup likely isn't worth the effort.