Hacker News new | ask | show | jobs
by tkinom 1877 days ago
Does go support "__builtin_expect" similar to gcc?

I optimized tight loop of network packets forwarding code with "__builtin_expect" and "inline" to get rid of at most all the branch delays and able to get > 10X increase in performance.

Wonder if same method can be used with "go"....

1 comments

If Go does have some kind of "__builtin_expect" equivalent, I can't find it.

I'd say it probably doesn't exist. Even if it _did_ exist, the Go compiler authors would reserve it for internal use only, like they do with most other Go compiler directives.