[go-nuts] The right way for golang binary to reduce iTLB cache miss

2021-09-17 Thread rmfr
One of our Golang applications has a very huge binary size and the size of the .text segment itself in the elf is approximately *34MB*. The iTLB load miss reaches about *87%* of all iTLB cache hits. Is there any advice for big Golang applications to reduce the iTLB cache miss? Two solutions com

[go-nuts] Re: Wrong output for (*http.Request).Write with custom io.ReadCloser body

2021-09-17 Thread Sean Liao
This was an intentional change in 1.8 https://github.com/golang/go/issues/20257#issuecomment-299509391 On Friday, September 17, 2021 at 6:45:13 AM UTC+2 dmo...@synack.com wrote: > Hi, when using a custom io.ReadCloser nop as body with method POST, PUT, > PATCH, TRACE or custom then (*http.Reque

[go-nuts] Re: The right way for golang binary to reduce iTLB cache miss

2021-09-17 Thread peterGo
rmfr, What is your data, what is its structure, and what are the access paths and frequencies? Your data is unlikely to be a randomly accessed blob of bits. Is there a set of Pareto access paths that you can use to order your data by access frequency? You want the most frequently accessed data

[go-nuts] how atomic instruction work?

2021-09-17 Thread xie cui
how atomic insturction work in golang at x86/amd64, I think the atomic insturtion will flush the store buffer and invalid queue of current cpu core, but I am not sure, does someone know about it? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

Re: [go-nuts] Re: The right way for golang binary to reduce iTLB cache miss

2021-09-17 Thread Robert Engels
This is the icache or code - not the data the code is accessing. > On Sep 17, 2021, at 8:12 AM, peterGo wrote: > >  > rmfr, > > What is your data, what is its structure, and what are the access paths and > frequencies? > > Your data is unlikely to be a randomly accessed blob of bits. Is the

[go-nuts] Re: go 1.17.1 in docker (m1) Segmentation Fault

2021-09-17 Thread Rémi Philippe
Hey Andrey, I tried with 1.17, same issue. I've raised a bug (https://github.com/golang/go/issues/48439) as it seems to impact all go commands (not just build). It's clearly linked to qemu/docker Thanks! Remi On Thursday, September 16, 2021 at 11:28:16 AM UTC-7 Andrey T. wrote: > Hi Remi, > >

[go-nuts] Z algorithm in string package

2021-09-17 Thread vl4deee11
Hello everyone, I need help, I often write algorithms on strings, and often I need such a thing as a *Z algo*, is it possible to add it to a *'std/strings'* package ? It can also be used in competitive programming, it is quite a useful thing. More about Z algo - https://www.geeksforgeeks.org/z

[go-nuts] Re: Wrong output for (*http.Request).Write with custom io.ReadCloser body

2021-09-17 Thread 'Diego Molina' via golang-nuts
Oh, thanks for clarifying that. But still, even if transfer encoding will be chunked, I don't see why it would make up a body of "0\r\n\r\n" if the nop body wouldn't give away any bytes at all. On Friday, September 17, 2021 at 7:56:21 AM UTC-3 seank...@gmail.com wrote: > This was an intentional

[go-nuts] Re: Wrong output for (*http.Request).Write with custom io.ReadCloser body

2021-09-17 Thread Brian Candler
All chunks must be prefixed by a chunk length - even if that length is zero. On Friday, 17 September 2021 at 16:53:07 UTC+1 dmo...@synack.com wrote: > Oh, thanks for clarifying that. But still, even if transfer encoding will > be chunked, I don't see why it would make up a body of "0\r\n\r\n" if

Re: [go-nuts] Re: Wrong output for (*http.Request).Write with custom io.ReadCloser body

2021-09-17 Thread 'Diego Molina' via golang-nuts
Ok, that makes total sense. I'm now using `req.TransferEncoding = []string{"identity"}` and this behaviour is suppressed, but of course I still don't get the Content-Length, which is fair. Thanks all! On Fri, Sep 17, 2021 at 2:09 PM Brian Candler wrote: > All chunks must be prefixed by a chunk

[go-nuts] Re: Z algorithm in string package

2021-09-17 Thread vl4deee11
I can create PR with Z algorithm пятница, 17 сентября 2021 г. в 16:38:41 UTC+1, vl4deee11: > Hello everyone, I need help, I often write algorithms on strings, and > often I need such a thing as a *Z algo*, is it possible to add it to a > *'std/strings'* package ? > It can also be used in comp

Re: [go-nuts] Z algorithm in string package

2021-09-17 Thread Ian Lance Taylor
On Fri, Sep 17, 2021 at 8:38 AM vl4deee11 wrote: > > Hello everyone, I need help, I often write algorithms on strings, and often I > need such a thing as a Z algo, is it possible to add it to a 'std/strings' > package ? > It can also be used in competitive programming, it is quite a useful thin

Re: [go-nuts] Z algorithm in string package

2021-09-17 Thread vl4deee11
Yes, this algorithm is mainly used to quickly find a substring in a string. O(n+m), where n=len(string), m=len(substring). I can run some tests to check, and post them here. But I would also like to add the z algorithm itself, this will be useful mainly for competitive programmers, and it will

Re: [go-nuts] Z algorithm in string package

2021-09-17 Thread Ian Lance Taylor
On Fri, Sep 17, 2021 at 12:03 PM vl4deee11 wrote: > > Yes, this algorithm is mainly used to quickly find a substring in a string. > O(n+m), where n=len(string), m=len(substring). I can run some tests to check, > and post them here. But I would also like to add the z algorithm itself, this > wil

Re: [go-nuts] how atomic instruction work?

2021-09-17 Thread Ian Lance Taylor
On Fri, Sep 17, 2021 at 6:25 AM xie cui wrote: > > how atomic insturction work in golang at x86/amd64, > I think the atomic insturtion will flush the store buffer and invalid queue > of current cpu core, > but I am not sure, does someone know about it? I assume that you are asking about the syn

Re: [go-nuts] Re: The right way for golang binary to reduce iTLB cache miss

2021-09-17 Thread rmfr
Thanks a lot :-D > This is the icache or code - not the data the code is accessing. Yes, it is the cache miss of iTLB, i.e. *Instruction* Translation Lookaside Buffer. I have tried the https://github.com/facebookincubator/BOLT, but the linker Golang used seems does not allow `--emit-relocs` o

Re: [go-nuts] Z algorithm in string package

2021-09-17 Thread vl4deee11
I think z algo can be third party lib. But i try to optimize strings.Index with z algo. Later i can show benchmarks. Thanks for your help! пятница, 17 сентября 2021 г. в 22:07:00 UTC+3, Ian Lance Taylor: > On Fri, Sep 17, 2021 at 12:03 PM vl4deee11 wrote: > > > > Yes, this algorithm is mainly