why golang not provide likely/unlikely syntax?

334 views
Skip to first unread message

cheng dong

unread,
Mar 20, 2023, 12:17:10 PM3/20/23
to golang-nuts
i see golang source ssa guess BranchLikely/BranchUnLikely, however we could not tell golang whether if is likely or unlikely. and looks the guess logic might be far away from real condition

Ian Lance Taylor

unread,
Mar 20, 2023, 5:49:34 PM3/20/23
to cheng dong, golang-nuts
On Mon, Mar 20, 2023 at 9:17 AM cheng dong <qq451...@gmail.com> wrote:
>
> i see golang source ssa guess BranchLikely/BranchUnLikely, however we could not tell golang whether if is likely or unlikely. and looks the guess logic might be far away from real condition

We don't want to complicate the language. Also, surprisingly,
experience shows that programmers are often mistaken as to whether
branches are likely or not. Instead, we are investigating
profile-guided optimization to make those choices. See
https://go.dev/blog/pgo-preview.

Ian

cheng dong

unread,
Mar 20, 2023, 9:48:32 PM3/20/23
to golang-nuts
pgo is great tool for optmize branch prediction, hope branch prediction feature merge into pgo as soon as possible
Reply all
Reply to author
Forward
0 new messages