Re: [go-nuts] When initializing variables, copies of values are made?

2019-01-31 Thread Ian Lance Taylor
On Thu, Jan 31, 2019 at 4:48 PM 伊藤和也 wrote: > > When initializing variables, If the copies of values are made, their memory > usages will be: > >> var a = [3]int8{2, 4, 6} >>| | >> >> 3 bytes + 3 bytes = 6 bytes > > >> var b = []int8[2, 4, 6} >>| | >>

Re: [go-nuts] Re: When initializing variables, copies of values are made?

2019-01-31 Thread Kurtis Rader
On Thu, Jan 31, 2019 at 8:46 PM 伊藤和也 wrote: > So in Go, > The meaning of "declare" is allocate memory for a variable and initialize > the variable explicitly or implicitly. > e.g. > var a int = 3 // "a" is explicitly initialized > var b int // "b" is implicitly initialized > You should

Re: [go-nuts] lock for assigning to different elements of an array

2019-01-31 Thread johnmrusk
> > Writing to adjacent memory locations [i.e. different array elements, from > different goroutines] will cause false sharing between CPU caches. This is > a performance, not a correctness issue. > I'm looking to make an array of thread-safe counters - each counting a different thing. I pro

[go-nuts] Re: When initializing variables, copies of values are made?

2019-01-31 Thread 伊藤和也
So in Go, The meaning of "declare" is allocate memory for a variable and initialize the variable explicitly or implicitly. e.g. var a int = 3 // "a" is explicitly initialized var b int // "b" is implicitly initialized The meaning of "assign" is give a copy of a value to a variable e.g.

[go-nuts] using docker for compiling

2019-01-31 Thread Keith Brown
does anyone use docker golang image to compile? if so,how is your setup? -- 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.

Re: [go-nuts] When initializing variables, copies of values are made?

2019-01-31 Thread Michael Jones
No. These are variable declarations not assignment statements. In the assignment “a = b” there is a copy implied but for the variable declaration the “=“ should not be read as “is copied to” but rather “of this kind”. var a is of the kind [3]bytes which happen to be 2, 4, and 6. Size = 3 Second

[go-nuts] When initializing variables, copies of values are made?

2019-01-31 Thread 伊藤和也
When initializing variables, If the copies of values are made, their memory usages will be: var a = [3]int8{2, 4, 6} >| | 3 bytes + 3 bytes = 6 bytes var b = []int8[2, 4, 6} >| | > 24 bytes + 24 bytes = 48 bytes var c = func() {} > |

Re: [go-nuts] Existing code for order-preserving concurrent work queue?

2019-01-31 Thread Bakul Shah
Here's a slightly different way of looking at this: It is known that if you have N servers, a single queue is better than N separate queues, so as to avoid the situation where you have an idle server with an empty queue and a waiting customer in a queue for a busy server. So the only other task is

Re: [go-nuts] Re: Existing code for order-preserving concurrent work queue?

2019-01-31 Thread Michael Jones
You deserve extra credit for getting the phrase "ouroboros data structure" in there. ;-) On Thu, Jan 31, 2019 at 10:20 AM roger peppe wrote: > On Thu, 31 Jan 2019 at 16:22, Michael Jones > wrote: > >> Agree. I’ve never had that level of imbalance but yes. >> > > When doing mathematical calculat

Re: [go-nuts] Re: Existing code for order-preserving concurrent work queue?

2019-01-31 Thread roger peppe
On Thu, 31 Jan 2019 at 16:22, Michael Jones wrote: > Agree. I’ve never had that level of imbalance but yes. > When doing mathematical calculations, as I think your code was, I think it's usual to have comparable costs for each item. By contrast, I'm usually adding this kind of code to make concu

[go-nuts] Re: [ANN] goey - Declarative, cross-platform GUIs

2019-01-31 Thread Robert Johnstone
Hello, Thank you for filing the two issues. Both have been resolved. Hopefully you won't find any other bugs... but if you do, please file an issue. Robert On Tuesday, 29 January 2019 16:15:01 UTC-5, Jake Montgomery wrote: > > This looks quite interesting for the types of simple apps I'm bui

Re: [go-nuts] Existing code for order-preserving concurrent work queue?

2019-01-31 Thread robert engels
I think that level of imbalance is the design thought behind “work stealing queues” - which is what Go schedulers uses.. no ? > On Jan 31, 2019, at 10:21 AM, Michael Jones wrote: > > Agree. I’ve never had that level of imbalance but yes. > > On Thu, Jan 31, 2019 at 4:06 AM roger peppe

Re: [go-nuts] Re: Existing code for order-preserving concurrent work queue?

2019-01-31 Thread Michael Jones
Agree. I’ve never had that level of imbalance but yes. On Thu, Jan 31, 2019 at 4:06 AM roger peppe wrote: > On Thu, 31 Jan 2019 at 00:06, Michael Jones > wrote: > >> note that my code sidesteps this problem generally >> > > I'm not sure that that's true. Although your code mitigates the problem

Re: [go-nuts] Re: Memory usages

2019-01-31 Thread Michael Jones
Yes. Now you can answer this question when the next person asks. On Wed, Jan 30, 2019 at 10:56 PM 伊藤和也 wrote: > OK, I want to make it clearer. > > Whether constants are untyped or typed, constants are treated at compile > time and originary there is no idea of how much memory constants take but

[go-nuts] Support for >31 bit sub-identifier in x509 certificate OIDs

2019-01-31 Thread adamyoung600
Referring to the fix put in place for this issue: https://github.com/golang/go/issues/19933 I have a user of our product (parts of it written in Go) who would like to use certificates supplied by their IT department. These certificates have a field containing their internal CertificatePolicyI

Re: [go-nuts] Re: Existing code for order-preserving concurrent work queue?

2019-01-31 Thread roger peppe
On Thu, 31 Jan 2019 at 00:06, Michael Jones wrote: > note that my code sidesteps this problem generally > I'm not sure that that's true. Although your code mitigates the problem somewhat, it's still possible for a one slow worker to block the others. You've added 512*NumCPU/2 buffer slots, but i

Re: [go-nuts] database/sql: NextResultSet API always return false

2019-01-31 Thread Lutz Horn
Then why this method is not works as expected using github.com/go-sql-driver/mysql for MySQL. It would have helped me if you'd have mentioned MySQL in your question. Your question was incomplete. Please take alook at http://www.catb.org/esr/faqs/smart-questions.html Take a look at this: htt

Re: [go-nuts] database/sql: NextResultSet API always return false

2019-01-31 Thread sagar puneria
Then why this method is not works as expected using github.com/go-sql-driver/mysql for MySQL. Take a look at this: https://play.golang.org/p/tCLKxiXPZ5e On Thursday, January 31, 2019 at 1:37:01 PM UTC+5:30, Lutz Horn wrote: > > Hi, > > > I just want to know in which case NextResultSet > >

Re: [go-nuts] database/sql: NextResultSet API always return false

2019-01-31 Thread sagar puneria
Then why this method is works as expected using github.com/go-sql-driver/mysql for MySQL. Take a look at this: https://play.golang.org/p/tCLKxiXPZ5e On Thursday, January 31, 2019 at 1:37:01 PM UTC+5:30, Lutz Horn wrote: > > Hi, > > > I just want to know in which case NextResultSet > >

Re: [go-nuts] How to do for inserting input data(http request post method) into postgresql database

2019-01-31 Thread Lutz Horn
I used net/http package to build up the http server with golang. Also,I make the simple Html page for front end . But I don't know how to do for inserting input data(http request post method) into postgresql database ? Any one could provide the sample code ? This may not be the best Go code ev

Re: [go-nuts] database/sql: NextResultSet API always return false

2019-01-31 Thread Lutz Horn
Hi, I just want to know in which case NextResultSet return true? This method works as expected using github.com/lib/pq for PostgreSQL. Take a lookt at this: https://gist.github.com/lutzhorn/1aa7de538d1edd0b3904799b5bb972fd The outpu