Re: [go-nuts] Benchmarking code that mutates its input data

2020-03-19 Thread Orson Cart
On Wednesday, 18 March 2020 15:50:33 UTC, Sam Whited wrote: > > Just call b.ResetTimer() after setting up your data: > https://godoc.org/testing#B.ResetTimer > Thanks, I'll take a look -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

Re: [go-nuts] Benchmarking code that mutates its input data

2020-03-19 Thread Orson Cart
On Wednesday, 18 March 2020 17:53:05 UTC, Robert Engels wrote: > > The test package has methods to disable the timing - wrap the setup in > these. > Thanks. I guess you're referring to StoptTimer, StartTimer and ResetTimer? I think that in my case ResetTimer will do the trick. Unless I'm mistak

Re: [go-nuts] Benchmarking code that mutates its input data

2020-03-19 Thread Orson Cart
On Wednesday, 18 March 2020 15:50:33 UTC, Sam Whited wrote: > > Just call b.ResetTimer() after setting up your data: > https://godoc.org/testing#B.ResetTimer > > Thanks, I'll take a look -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsu

Re: [go-nuts] Benchmarking code that mutates its input data

2020-03-18 Thread Robert Engels
The test package has methods to disable the timing - wrap the setup in these. > On Mar 18, 2020, at 10:50 AM, Sam Whited wrote: > > I'd like to quickly suggest that the "filtering without allocating" > technique from this page is probably what you want and you may want to > consider if/why you

Re: [go-nuts] Benchmarking code that mutates its input data

2020-03-18 Thread Sam Whited
I'd like to quickly suggest that the "filtering without allocating" technique from this page is probably what you want and you may want to consider if/why you even need to benchmark this: https://github.com/golang/go/wiki/SliceTricks However, if you do need to benchmark it: On Wed, Mar 18, 2020,

[go-nuts] Benchmarking code that mutates its input data

2020-03-18 Thread Orson Cart
We have a slice containing a mix of data items, some of which are deemed to be 'valid', some 'invalid'. We need to remove the invalid items. In the current implementation we have a function which takes the slice as input and removes the invalid' elements from it in place i.e. not from a copy.