I already have a go routine on the anonymous function:
go func(start, end, i int, quit chan string) {

You are suggesting doing this?
go func(start, end, i int, quit chan string) {
      go BytesContainsCh1(b.Bytes(), start, end, find, ch)
   }(start, end, i, quit)

On Sunday, June 12, 2022 at 2:54:51 AM UTC-7 Brian Candler wrote:

> On Sunday, 12 June 2022 at 09:16:30 UTC+1 Const V wrote:
>
>>   go func(start, end, i int, quit chan string) {
>>       BytesContainsCh1(b.Bytes(), start, end, find, ch)
>>    }(start, end, i, quit)
>>
>
> I note that this could be further simplified to:
>
> go BytesContainsCh1(b.Bytes(), start, end, find, ch)
>  
> Maybe the compiler does this optimisation automatically.  Does it make any 
> difference to your timings?
>
> If you want to understand the difference you might need to look at the 
> assembly language generated. See what happens with the number of stack 
> frames allocated, whether the unused argument 'i' is elided in one of the 
> cases, and so on.
>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ea984e9d-07a0-46d8-8e3e-6f23e0222278n%40googlegroups.com.

Reply via email to