News for hackers. Stuff that matters.
Re:Go’s hidden pragmas by saagarjha on Monday January 08, 2018 @10:28AM (#16097350)
Yeah, that’s what I was getting at. Race condition detection would probably slow down your code, so you probably wouldn’t use it in production.
Re:Go’s hidden pragmas by LukeShu on Monday January 08, 2018 @10:52AM (#16097537)
Race detection is totally disabled for production binaries, because it does slow down the code.

The question is: For debug builds that explicitly have the "-race" flag passed to the compiler, why would you want to disable race detection for a specific function?

Re:Go’s hidden pragmas by nemo1618 on Monday January 08, 2018 @11:46AM (#16097934)
I actually do have a real example of this.

We use -race during our automated testing. The setup for some of our tests involves CPU mining (rapid blake2b hashing). This code definitely doesn't have any races, and it runs waaaaay slower when race detection is enabled. So we could speed up our tests significantly by disabling race detection just for the setup phase.

Re:Go’s hidden pragmas by hmmdar on Monday January 08, 2018 @12:12PM (#16098156)
Have you considered enabling parallel tests for that package? It let's test functions run in parallel with each other. Might address some of the issue with the performance.
Re:Go’s hidden pragmas by perfmode on Monday January 08, 2018 @11:32AM (#16097832)
Unless you’re IO bound?