Re: [go-nuts] A question about performance when traverse the array with row-wise and column-wise

2019-09-29 Thread zct
I think in my test code, what affect the performance maybe the cpu branches misses? The row num is bigger than the column num, so in column-wise traverse, the inner loop is easier to predict. perf result: row-wise 0.034014712741,811 branch-misses # 1.05%

Re: [go-nuts] Channels question

2019-09-29 Thread Kurtis Rader
On Sun, Sep 29, 2019 at 2:04 PM Joe McGuckin wrote: > If i have multiple goroutines listening on the same channel, then write > something to the channel, will all goroutines receive the value, or only > the ‘next’ available goroutine (as determined by the scheduler) > Channels are queues:

[go-nuts] Channels question

2019-09-29 Thread Joe McGuckin
If i have multiple goroutines listening on the same channel, then write something to the channel, will all goroutines receive the value, or only the ‘next’ available goroutine (as determined by the scheduler) Thanks, Joe -- You received this message because you are subscribed to the Google

[go-nuts] Re: lots of 'undeclared name' errors with vscode/gopls

2019-09-29 Thread JuciÊ Andrade
Gopls depends on finding a go.mod file, otherwise you get lots of "undeclared name". If it's not there just go to your project root folder and issue the command "go mod init". -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] A question about performance when traverse the array with row-wise and column-wise

2019-09-29 Thread 'Michael Stiller' via golang-nuts
On my machine using an intel 9880H with a L2 Cache: Unified, 256 KiB, 4-way set associative, rows vs. columns performance is basically the same as long as the array size fits into the L2 cache. This seems to be the case for a rowSize = colSize = 180. For slightly higher values (190) the

Re: [go-nuts] How to use .toml file to parse IP address and port to http server

2019-09-29 Thread Andrew Pillar
Use net.JoinHostPort to concatenate the values you have in the struct and pass the to http.Server struct. if _, err := toml.Decode("config.toml", ); err != nil { // handle error } addr, err := net.JoinHostPort(conf.Address, conf.PORT) if err != nil { // handle error } src

[go-nuts] A question about performance when traverse the array with row-wise and column-wise

2019-09-29 Thread zct
The test code is below: package main import ( "testing" ) const rowSize = 100 const colSize = 100 var array [rowSize][colSize]int func BenchmarkRow(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { sum := 0 for r := 0; r < rowSize; r++ { for c := 0; c < colSize; c++ { sum +=

[go-nuts] How to use .toml file to parse IP address and port to http server

2019-09-29 Thread afriyie . abraham
Hi, How I can use the .toml file to parse IP address and port to simple http server instead of using flags I have a config.toml file which contains these parameters in PORT = "8000" Address = "localhost" //Parameters type struct as type Config struct { PORTstring Address string } I can

Re: [go-nuts] Golang library for - ORM & Schema Migration

2019-09-29 Thread Space A.
ORM is a tool. It's not good or bad. Every tool, every language and everything has limits. If you like spending time on writing and debugging raw SQL - go ahead. The difference and very obvious in this discussion, is that those who are not against ORM not trying to convince other party to only use