[go-nuts] Re: Can a golang program be compiled to run with only ONE goroutine ?

2024-09-10 Thread Zxilly Chou
If you compile it to WebAssembly, it will works under the single thread model. However, there are still multi *goroutine *be created, it was designed to. 在2024年9月10日星期二 UTC+8 21:54:56 写道: > Hello, > > Maybe the question has already been asked, but I would be glad to have > your feedback. > >

[go-nuts] Why is there a huge gap between the memory profile's inuse_space in pprof and the externally obtained memory footprint?

2024-07-20 Thread Zxilly Chou
I'm working on the project https://github.com/Zxilly/go-size-analyzer, a program that can be very memory intensive, so I've written some scripts to fetch the pprof file during integration testing, and I'm using python's psutil to read the cpu and memory usage to automatically plot into the im

[go-nuts] Re: go tool cover vs go tool covdata

2024-07-12 Thread Zxilly Chou
Simply, cover for text format coverage and covdata for bianry format. 在2024年7月10日星期三 UTC+8 18:07:21 写道: > what is the difference between go tool cover and go tool covdata ? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from t

Re: [go-nuts] strip / reduce module compile size

2024-06-18 Thread Zxilly Chou
Please try https://github.com/Zxilly/go-size-analyzer . I created this based on reverse engineering, so only the bytes in the final build will be count. 在2024年6月18日星期二 UTC+8 01:14:09 写道: > Are there other tools that may show the final size? I'd like to see if > there are more aggressive flags

[go-nuts] Discover go-size-analyzer: Streamline Your Go Binary Insights

2024-05-21 Thread Zxilly Chou
Hello go-nuts, I'm excited to share a new tool that has landed in our Go ecosystem: go-size-analyzer. This utility is designed to give you a clear picture of the size of your compiled Go binaries, with a focus on how dependencies contribute to the overall footprint. It simplifies the process

[go-nuts] Re: programmatic way to find if application go binary is built with -cover flag ?

2024-05-13 Thread Zxilly Chou
try debug.ReadBuildInfo(), then iterate the pair in the buildinfo.Settings 在2024年5月13日星期一 UTC+8 20:56:51 写道: > Is there a way in go to find whether a go binary is built with -cover flag > ? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To un

[go-nuts] Re: Reproducible builds with CGO

2024-04-26 Thread Zxilly Chou
golang will embed the path of the source file into the binary, also the .gopclntab will contains the path. try use -trimpath and see if there's any change. 在2024年4月27日星期六 UTC+8 01:28:05 写道: > Hi All, > > *Does anybody have experience in how the use of CGO and dynamic linking > may affect the re

[go-nuts] Which part of go compiler set the symbol "runtime.text" in the final build?

2024-01-24 Thread Zxilly Chou
Yesterday, I reported an issue on debug/gosym at issues/65232 regarding the difference between the symbol table and gopclntab. A member of the Go team informed me that the start of the .text segment is not always kept the same as 'runtime.text' value. I am curious about how the compiler sets th

[go-nuts] Re: Some confusion about escape analysis

2022-08-26 Thread Lee Chou
Thanks for taking the time for the clue. It seems that this is an open issue. Actually, It work for this case. aovid the alloc will have more benefit for gc. 在2022年8月26日星期五 UTC+8 02:49:08 写道: > Actually, looking more closely at your benchmark numbers, the trick does > not work in your case.

[go-nuts] Some confusion about escape analysis

2022-08-23 Thread Lee Chou
I was try using net.Buffers for writev. But I meet a unexptected allocs in benchmark. https://go.dev/play/p/SHpxSYbP1I5 when I run the benchmark: goos: linux goarch: amd64 pkg: writev BenchmarkWrite_Writev/escape-4 272901 4198 ns/op 24 B/op 1 allocs/

Re: [go-nuts] defer func running timing

2022-06-26 Thread Lee Chou
evaluated immediately, but the execution only > happens later > > - sean > > On Sat, Jun 25, 2022, 21:40 Lee Chou wrote: > >> Hello, >> >> https://go.dev/play/p/J1tVplkIrjt >> >> why o1.Ref print `2` but p1.Ref print `1` ? >> why o1.Ref pri

[go-nuts] defer func running timing

2022-06-25 Thread Lee Chou
Hello, https://go.dev/play/p/J1tVplkIrjt why o1.Ref print `2` but p1.Ref print `1` ? why o1.Ref print `2` but o2.NonRef print `3` ? it's so confused. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rec

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
rw.r.Intn(rw.sumOfWeights) //fmt.Printf("rand val: %d\n",randomWeight) ... } I am sorry about that I did't give the context of my code. 在 2019年6月27日星期四 UTC+8上午11:22:49,Kurtis Rader写道: > > On Wed, Jun 26, 2019 at 8:18 PM Chou Yan > wrote: > >> I fix it by : >> &g

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
ializing the RNG in a tight loop. Since > `time.Now().Unix()` has a resolution of one second you end up generating > the same initial value every time through the loop until the current time > advances to the next second. > > On Wed, Jun 26, 2019 at 7:48 PM Chou Yan > wrote:

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
,errors.New("get next err") } return no, nil } } thx 在 2019年6月27日星期四 UTC+8上午11:16:01,Chou Yan写道: > > The situation I am currently experiencing is that it only occur on my > online app. I try it at local but I can not got the result. > haha... I make a mistake. > the code i

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
6月27日星期四 UTC+8上午10:52:56,Burak Serdar写道: > > On Wed, Jun 26, 2019 at 8:48 PM Chou Yan > wrote: > > > > like this: > > r:=rand.New(rand.NewSource(time.Now().Unix())) > > for { > > r.Intn(96) > > } > > I know the same seed will generate t

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
o()', It will not. I suspect what this is related to the seqence rand algorithm,But I have no relevant evidence 在 2019年6月27日星期四 UTC+8上午10:32:38,Burak Serdar写道: > > On Wed, Jun 26, 2019 at 8:17 PM Chou Yan > wrote: > > > > I use: > > r:=rand.New(rand.NewSource(t

[go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now().U

2019-06-26 Thread Chou Yan
I use: r:=rand.New(rand.NewSource(time.Now().Unix())) r..Intn(96) I got: and val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand

[go-nuts] Re: how to decrease the HeapIdle of Memory to free memory to Linux?

2019-06-23 Thread Chou Yan
I use 'debug.FreeOsMemory'. But it is not the certain. 在 2019年6月24日星期一 UTC+8上午10:59:06,Chou Yan写道: > > My server have 100G memory. > I limit my server 60G by cgroups. > But my app process use the momory more and more ! > even more than 50G. > my prof: > > # He

[go-nuts] Re: how to decrease the HeapIdle of Memory to free memory to Linux?

2019-06-23 Thread Chou Yan
I am use 'debug.FreeOsMemory'. But it is not the certain. 在 2019年6月24日星期一 UTC+8上午10:59:06,Chou Yan写道: > > My server have 100G memory. > I limit my server 60G by cgroups. > But my app process use the momory more and more ! > even more than 50G. > my prof:

[go-nuts] Re: how to decrease the HeapIdle of Memory to free memory to Linux?

2019-06-23 Thread Chou Yan
40585/0+297 ms cpu, 22495->22569->4643 MB, 23425 MB goal, 64 P 在 2019年6月24日星期一 UTC+8上午10:59:06,Chou Yan写道: > > My server have 100G memory. > I limit my server 60G by cgroups. > But my app process use the momory more and more ! > even more than 50G. > my prof: > >

[go-nuts] how to decrease the HeapIdle of Memory to free memory to Linux?

2019-06-23 Thread Chou Yan
My server have 100G memory. I limit my server 60G by cgroups. But my app process use the momory more and more ! even more than 50G. my prof: # HeapIdle = 27377164288 # HeapInuse = 21910396928 The Cgroup will kill the process when it use more than 60G But golang runtime gc will not release the

Re: [go-nuts] How many times gc stw ?

2019-06-21 Thread Chou Yan
thx 在 2019年6月21日星期五 UTC+8下午12:38:50,Ian Lance Taylor写道: > > On Thu, Jun 20, 2019 at 7:22 PM Chou Yan > wrote: > > > > The describe 'release the physical memory' may not be rigorous. Because > gc remand the span,obj, or big obj to heap or central area, may

Re: [go-nuts] How many times gc stw ?

2019-06-20 Thread Chou Yan
during sweep termination? 在 2019年6月21日星期五 UTC+8上午8:54:31,Ian Lance Taylor写道: > > On Thu, Jun 20, 2019 at 9:56 AM Chou Yan > wrote: > > > > I look up the doc for gctrace: > > https://godoc.org/runtime > > it show us: > > > > Currently, it is: >

Re: [go-nuts] How many times gc stw ?

2019-06-20 Thread Chou Yan
weep = scan the root span', like java cms 'gc root scan'? not the release the physical memory? 在 2019年6月21日星期五 UTC+8上午8:54:31,Ian Lance Taylor写道: > > On Thu, Jun 20, 2019 at 9:56 AM Chou Yan > wrote: > > > > I look up the doc for gctrace: > > https://god

[go-nuts] How many times gc stw ?

2019-06-20 Thread Chou Yan
I look up the doc for gctrace: https://godoc.org/runtime it show us: Currently, it is: gc # @#s #%: #+#+# ms clock, #+#/#/#+# ms cpu, #->#-># MB, # MB goal, # P where the fields are as follows: gc #the GC number, incremented at each GC @#s time in seconds s

Re: [go-nuts] How to set a callback for cgo ?

2019-01-16 Thread astone . chou
sorry for late reply. thanks very much. it got the key. 在 2019年1月11日星期五 UTC+8下午10:09:17,Jan Mercl写道: > > > On Fri, Jan 11, 2019 at 2:49 PM > wrote: > > > I get the file 'exit0', but didn't get the file 'exit1'. > > As far as I can tell, it works as expected. Exit handlers are called when > libc's

[go-nuts] How to set a callback for cgo ?

2019-01-11 Thread astone . chou
Hi everyone, I want to set a callback for atexit, but it seems doesn't work. This is my code. package main /* #include extern void AtExit(); static inline set_atexit() { atexit(AtExit); AtExit(); } */ import "C" import ( "fmt" "io/ioutil" "time" ) var n = 0 //expor

[go-nuts] Re: Dave Cheney's "Practical Go" book

2017-09-04 Thread chou
I want to buy one, is it released out? 在 2017年9月5日星期二 UTC+8上午7:41:36,st ov写道: > > Any information on the contents and a release date? > > Couldn't find any details on O'reilly, Amazon or dave.cheney.net. > -- You received this message because you are subscribed to the Google Groups "golang-nuts

Re: [go-nuts] Why constant is not addressable in golang?

2017-08-21 Thread chou
stant anymore. The minimum Go would need, to > make constants addressable would be some notion of const-pointers (that is, > pointers which don't allow modification of the pointee). > > May I ask why it would be interesting to take the address of a constant? > > On Mon, Aug 21,

[go-nuts] Why constant is not addressable in golang?

2017-08-20 Thread chou
I guess that const will be substitute literally at compile time for performance improvements. So there is not such variable in run time. Is it right? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivi

Re: [go-nuts] Does scheduler step in my weighted fair queue implementation?

2017-07-14 Thread Chifeng Chou
ul 13, 2017 at 9:15 PM, Chifeng Chou > wrote: > > > > I implemented a weighted fair queue using a naive approach which is > giving > > different amount of attempts according to weights to access upstreams. > > However, when calls of fetch() come very fast, our inter

[go-nuts] Does scheduler step in my weighted fair queue implementation?

2017-07-13 Thread Chifeng Chou
I implemented a weighted fair queue using a naive approach which is giving different amount of attempts according to weights to access upstreams. However, when calls of fetch() come very fast, our internal sync constructs are not ready(when *select*) and many attempts are simply wasted. It seems