[go-nuts] Re: range-over-func has two more alloc than direct-call-func Why?

2024-03-13 Thread 'qiulaidongfeng' via golang-nuts
I got the information ./main_test.go:23:3: func literal escapes to heap: ./main_test.go:23:3: flow: {heap} = &{storage for func literal}: ./main_test.go:23:3: from func literal (spill) at ./main_test.go:23:3 ./main_test.go:23:3: from .autotmp_3(func literal) (call parameter) at

[go-nuts] range-over-func has two more alloc than direct-call-func Why?

2024-03-12 Thread 'qiulaidongfeng' via golang-nuts
For the following code https://go.dev/play/p/ynn7ihKXrp0?v=gotip I got the benchmark BenchmarkBelow3-16 9523 147772 ns/op 17 B/op 2 allocs/op BenchmarkBelow3direct-16 1 107335 ns/op 0 B/op 0 allocs/op range-over-func has two more alloc than direct-call-func. Why? -- You received

[go-nuts] Re: 64 Tiny Algorithmic Puzzles in Go

2024-03-02 Thread 'qiulaidongfeng' via golang-nuts
I wrote a correct one, as shown here: https://go.dev/play/p/IDJP_iIsGDE On Sunday, March 3, 2024 at 1:42:51 AM UTC+8 BUGFIX 66 wrote: > https://BUGFIX-66.com > > Solve each puzzle by making a tiny change to a short piece of Go code. > Edited code is compiled and tested on the host server. > Each

[go-nuts] Re: net/http: 1.22.0, Enhanced routing, httpmuxgo121

2024-02-11 Thread 'qiulaidongfeng' via golang-nuts
If you want to default GODEBUG=httpmuxgo121=0. One way to do this is to set go1.22.0 on the go line of go.mod, or add a //go:debug httpmuxgo121=0 to the go file of the main package. On Monday, February 12, 2024 at 3:09:38 PM UTC+8 qiulaidongfeng wrote: > Starting with go1.21, GODEBUG is set by

[go-nuts] Re: net/http: 1.22.0, Enhanced routing, httpmuxgo121

2024-02-11 Thread 'qiulaidongfeng' via golang-nuts
Starting with go1.21, GODEBUG is set by default according to the go line of go.mod. On Monday, February 12, 2024 at 11:47:31 AM UTC+8 xab3r wrote: > Hello there > > I've just tried new routing patterns in Go 1.22.0, and I noticed that I > have to set httpmuxgo121=0 explicitly in order to get

[go-nuts] Re: Profiling and PGO

2024-02-09 Thread 'qiulaidongfeng' via golang-nuts
Using benchmark and benchstat, you can compare the improvement obtained with PGO . On Friday, February 9, 2024 at 10:43:16 PM UTC+8 Agustin Horacio Urquiza Toledo wrote: > I’m trying to compare the efficiency of two binaries before and after > applying Profile-Guided Optimization . For this,

[go-nuts] Re: Go 1.22 binary size improvements?

2024-02-09 Thread 'qiulaidongfeng' via golang-nuts
Quick search to find go1.22 as follows CL like https://go-review.googlesource.com/c/go/+/521615 reduces binary size. However, from 93MB to 81MB, I think it is most likely the result of the joint efforts of many CLs. On Friday, February 9, 2024 at 7:46:48 PM UTC+8 cpu...@gmail.com wrote:

[go-nuts] What are the reason for the performance improvement cause by alloc data of different sizes to adjacent memory addresses?

2024-02-09 Thread 'qiulaidongfeng' via golang-nuts
I recently added a new API (AllocSoonUse) to the https://gitee.com/qiulaidongfeng/arena I wrote (copy in https://github.com/qiulaidongfeng/arena) This API allocdata to adjacent []byte, and the length can be set. I use this benchmark code : https://go.dev/play/p/nAGveraT5_h benchmark Brief

[go-nuts] runtime: idea for usse Bump-pointer allocation

2024-01-23 Thread 'qiulaidongfeng' via golang-nuts
See https://github.com/golang/go/issues/51317#issuecomment-1905287203 Bump-pointer allocation is an interesting direction to explore. I will describe, in a bottom-up way, an idea for implementing Bump-pointer allocation. On each P or M, there is a P or M exclusive bumpPtr, and runtime.malloc

[go-nuts] Re: How long should the profiles be to use with Profile-Guided Optimization (PGO)?

2024-01-23 Thread 'qiulaidongfeng' via golang-nuts
In my experience, if defult.pgo shows hot path. 30s can have a good optimization. On Monday, January 22, 2024 at 11:21:51 PM UTC+8 Agustin Horacio Urquiza Toledo wrote: > Hello, > > I am trying to use PGO in my project and I would like to know how well it > works. I have collected 10

[go-nuts] Re: prevent download static files

2024-01-19 Thread 'qiulaidongfeng' via golang-nuts
Please show a code that rewrites your problem with as little as possible. Thanks. On Saturday, January 20, 2024 at 3:59:59 AM UTC+8 Moein Ghasemi wrote: > how can i allow my client to only see my static files which served by > server > and prevent download . > im using echo > > Thanks. >

[go-nuts] gotip tool dist test -race may not have making effective use of multiple cores

2024-01-11 Thread 'qiulaidongfeng' via golang-nuts
I run gotip tool dist test -race I have noticed that many times when I run benchmark, CPU utilization is very low (about one core is used). I don't think github issue is the place to have that discussion. So come here and ask. I want someone to answer that Whether the gotip tool dist test -race

[go-nuts] How do I get a benchmark for the go toolchain instead of the compiler?

2023-12-16 Thread 'qiulaidongfeng' via golang-nuts
https://go-review.googlesource.com/c/go/+/533015 use pgo for the entire tool chain, not just to the compiler. See https://github.com/golang/go/blob/master/src/cmd/compile/profile.sh, default.pgo contains the data of the std and cmd, so should for the other go tool chain is also useful. But