Hacker News new | ask | show | jobs
by bugfix-66 1298 days ago
Similarly, you can turn off bounds-checking in Go like this:

  go build -gcflags=-B
and see if it helps. Generally the assembly looks better, but it doesn't really run faster on a modern chip.

Do your own test, and keep the results in mind next time somebody on Hacker News dismisses Go because of the "overwhelming cost of bounds checking".

2 comments

> next time somebody on Hacker News dismisses Go because of the "overwhelming cost of bounds checking".

That’s certainly one criticism I don’t remember ever seeing.

There's a few examples like this https://news.ycombinator.com/item?id=32256038 if you search comments for "go bounds checking"
It appears that the flag keeps being undocumented, though.

https://pkg.go.dev/cmd/compile