Re: [go-nuts] strange benchmark result: inline is slower than function calls

2017-05-01 Thread peterGo
T L, .go : https://play.golang.org/p/GPGO7YnLxh Peter On Monday, May 1, 2017 at 1:15:38 PM UTC-4, peterGo wrote: > > T L, > > First, keep things simple. Delete the main function; it's an irrelevant > complication. Use shorter function names. Start simply and build one > feature at a time.

Re: [go-nuts] strange benchmark result: inline is slower than function calls

2017-05-01 Thread peterGo
T L, First, keep things simple. Delete the main function; it's an irrelevant complication. Use shorter function names. Start simply and build one feature at a time. Function is exactly like except that variables are substituted for the function parameter. Function is exactly lik

Re: [go-nuts] strange benchmark result: inline is slower than function calls

2017-04-29 Thread T L
On Sunday, April 30, 2017 at 7:33:38 AM UTC+8, Ian Lance Taylor wrote: > > On Sat, Apr 29, 2017 at 1:43 AM, T L > > wrote: > > > > package main > > > > import ( > > "testing" > > ) > > > > const N = 4096 > > type T int64 > > var a [N]T > > > > var globalSum T > > > > func sumBy

Re: [go-nuts] strange benchmark result: inline is slower than function calls

2017-04-29 Thread Ian Lance Taylor
On Sat, Apr 29, 2017 at 1:43 AM, T L wrote: > > package main > > import ( > "testing" > ) > > const N = 4096 > type T int64 > var a [N]T > > var globalSum T > > func sumByLoopArray_a(p *[N]T) T { > var sum T > for i := 0; i < len(p); i++ { > sum += T(p[i]) > } > return

[go-nuts] strange benchmark result: inline is slower than function calls

2017-04-29 Thread T L
package main import ( "testing" ) const N = 4096 type T int64 var a [N]T var globalSum T func sumByLoopArray_a(p *[N]T) T { var sum T for i := 0; i < len(p); i++ { sum += T(p[i]) } return sum } func sumByLoopArray_b(p *[N]T) T { var sum T for i := 0; i < le