Re: [go-nuts] about the memclr optimization

2017-02-11 Thread T L
On Saturday, February 11, 2017 at 4:23:07 PM UTC+8, Axel Wagner wrote: > > To expand on Dave's point: Your function has a data race (reads/writes > concurrent with writes in different goroutines) and thus its behavior is > not defined. Run with the benchmark with -race to confirm. The compiler

Re: [go-nuts] about the memclr optimization

2017-02-11 Thread 'Axel Wagner' via golang-nuts
To expand on Dave's point: Your function has a data race (reads/writes concurrent with writes in different goroutines) and thus its behavior is not defined. Run with the benchmark with -race to confirm. The compiler can pretty much do, what it wants in that case. You need to add synchronization

[go-nuts] about the memclr optimization

2017-02-10 Thread Dave Cheney
It's neither, its undefined. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit

[go-nuts] about the memclr optimization

2017-02-10 Thread T L
https://github.com/golang/go/issues/5373 I made a test package main import ( "testing" ) const N = 1024 * 100 var a [N]int func BenchmarkArrayPtr(b *testing.B) { for i := 0; i < b.N; i++ { for i := range { a[i] = 0 } } } func BenchmarkArray(b