[go-nuts] Why makechan distinguish elements do not contain pointers or contain pointers?

2019-01-24 Thread mountainfpf
go 1.11.1 source code is below: Generally speaking, make chan just pay attention to the presence or absence of buf. When I saw the source code of make chan, I can understand case 1: chan buf is 0, but can't understand case 2 & default. Who knows this principle? Thanks! var c *hchan

Re: [go-nuts] The performance comparation of Golang and Java

2019-01-24 Thread Sebastien Binet
Also-rans: the global math/rand functions are thread safe (drawing a random number is protected by a mutex.) If the Java one isn't thread safe, you are comparing apples with oranges. Try creating a local rand.Rand and see what gives. HTH, -s sent from my droid On Fri, Jan 25, 2019, 07:45

Re: [go-nuts] The performance comparation of Golang and Java

2019-01-24 Thread Michael Jones
Also...pseudo-random number generation is not a specific computation; there are many ways to do it--some faster some slower, some better some worse. If you want to time a general poisson disc simulation you would be better with a grid than calls to rand() because now you are testing the speed of

Re: [go-nuts] The performance comparation of Golang and Java

2019-01-24 Thread Ian Lance Taylor
On Thu, Jan 24, 2019 at 7:01 PM Karthik Krishnaswamy wrote: > > I am just curious to understand what is the best possible way to increase the > execution speed of this particular program ? I am still learning go though :) To speed up that particular program, don't use recursive Fibonacci. The

Re: [go-nuts] The performance comparation of Golang and Java

2019-01-24 Thread Karthik Krishnaswamy
I am just curious to understand what is the best possible way to increase the execution speed of this particular program ? I am still learning go though :) On Fri, Jan 25, 2019 at 8:26 AM Ian Lance Taylor wrote: > On Thu, Jan 24, 2019 at 6:21 PM Topget wrote: > > > > I have tested several

[go-nuts] Re: The performance comparation of Golang and Java

2019-01-24 Thread Pat Farrell
On Thursday, January 24, 2019 at 9:21:14 PM UTC-5, Topget wrote: > > I have tested several simple functions with Golang and Java. To my > surprise, Java sometimes is faster than Golang(especially in recursive > function and some function in standard library such as math/rand.Rand). > What

[go-nuts] Re: The performance comparation of Golang and Java

2019-01-24 Thread Dmitry Ponyatov
You should also take into account resource consumption, primarily RAM usage (and also CPU usage for runtime action itself: not linked with application logic). So you should normalize your benchmarks by RAM usage, and it will give you 100x of golang efficiency. Java critically requires 2G of

Re: [go-nuts] The performance comparation of Golang and Java

2019-01-24 Thread Ian Lance Taylor
On Thu, Jan 24, 2019 at 6:21 PM Topget wrote: > > I have tested several simple functions with Golang and Java. To my surprise, > Java sometimes is faster than Golang(especially in recursive function and > some function in standard library such as math/rand.Rand). I wonder why. Here > is some

Re: [go-nuts] The performance comparation of Golang and Java

2019-01-24 Thread Rodolfo
You only checking speed, you need to check memory and cpu too. Java is faster because it allocate too much memory and If your tests during a lot of time you will see the performance degrade, Go in other hand grow and use less memory. My explanation is not complete, But I am a Java developer and

[go-nuts] Re: The performance comparation of Golang and Java

2019-01-24 Thread Jimmy Wong
https://golang.org/doc/faq#Why_does_Go_perform_badly_on_benchmark_x On Friday, January 25, 2019 at 10:21:14 AM UTC+8, Topget wrote: > > I have tested several simple functions with Golang and Java. To my > surprise, Java sometimes is faster than Golang(especially in recursive > function and some

[go-nuts] The performance comparation of Golang and Java

2019-01-24 Thread Topget
I have tested several simple functions with Golang and Java. To my surprise, Java sometimes is faster than Golang(especially in recursive function and some function in standard library such as math/rand.Rand). I wonder why. Here is some code I used for test and the result. Golang code:

Re: [go-nuts] Producer-Consumer with Goroutines

2019-01-24 Thread Michael Jones
It works correctly. What you see is the race between the printf calls at each iteration On Thu, Jan 24, 2019 at 2:40 PM diego patricio wrote: > Hi, I just want to achieve that one goroutine send a data and another > goroutine receive it and print it consequently, for instance o, 1, 2, 3. > > Is

[go-nuts] Re: any discourse-like forum in Go?

2019-01-24 Thread guohuang
check out https://github.com/godiscourse/godiscourse, it is a bit new, under heavy development! On Wednesday, January 31, 2018 at 8:29:25 AM UTC-8, Sebastien Binet wrote: > > hi there, > > I am looking for a discourse-like forum, in Go. Does anybody know of such > a thing? > > Interestingly,

Re: [go-nuts] Producer-Consumer with Goroutines

2019-01-24 Thread diego patricio
Hi, I just want to achieve that one goroutine send a data and another goroutine receive it and print it consequently, for instance o, 1, 2, 3. Is there a correct way to achieve this ? Regards El jue., 24 ene. 2019 a las 23:08, Ian Denhardt () escribió: > In general, after the message send goes

Re: [go-nuts] Producer-Consumer with Goroutines

2019-01-24 Thread Ian Denhardt
In general, after the message send goes through, the two goroutines involved could start executing again in any order -- so the behavior you're seeing is expected? Is there a less toy example that this is supposed to be representative of? Or were you just expecting it to work differently, and

Re: [go-nuts] Producer-Consumer with Goroutines

2019-01-24 Thread diego patricio
Hi, thanks for your response, still I dont get right result [image: image.png] [image: image.png] El jue., 24 ene. 2019 a las 22:42, Christian Staffa (< christian.p.sta...@gmail.com>) escribió: > Hi > > to get a synchronization with goroutines you need to use an unbuffered > channel. you have

Re: [go-nuts] Producer-Consumer with Goroutines

2019-01-24 Thread Christian Staffa
Hi to get a synchronization with goroutines you need to use an unbuffered channel. you have used a buffered channel of 1. Sent from my iPhone > On 24. Jan 2019, at 22:11, diego patricio wrote: > > Hi all, i'am just learning Go and goroutines, I have three goroutines (main, > producer,

[go-nuts] Producer-Consumer with Goroutines

2019-01-24 Thread diego patricio
Hi all, i'am just learning Go and goroutines, I have three goroutines (main, producer, consumer) and I dont know how synchronize producer and consumer for print one value at time, the output that I want is Producer 0 Consumer 0 Producer 1 Consumer 1 .. but the output of my program it's

Re: [go-nuts] Why is Context explicit vs. implicit in Go?

2019-01-24 Thread Ian Denhardt
There's actually been a fair amount of conversation on this topic lately. Most recently it came up in this thread: https://groups.google.com/forum/#!searchin/golang-nuts/context|sort:date/golang-nuts/Lqoj5bNQxzg/5LUEYGHAGQAJ My biggest worry about making it implicit is that it becomes hard

[go-nuts] Why is Context explicit vs. implicit in Go?

2019-01-24 Thread David Suarez
First off, I am really loving Go overall. I probably did what many do and started out with less Context use and now it is becoming a standard for a few tiers which I see was in a blog somewhere from Google as well. What I haven't been able to find is if there has ever been a conversation on

[go-nuts] GoLand 2019.1 EAP started today

2019-01-24 Thread Florin Pățan
Hi gophers, Today we started the 2019.1 EAP for GoLand. While we are just beginning to roll out the new version, here's a couple of features which might be interesting to use: - Smart Step Into -> a debugging feature which lets you step into arbitrary calls in an expression, automatically

Re: [go-nuts] GitHub go-formal ownership

2019-01-24 Thread Scott Cotton
As others might wonder about knowledge requirements I thought I'd follow up here too. Currently, there is only one rule about the go-formal organisation: no private members. This doesn't require "formal" knowledge as is. The idea when go-formal started was to provide a place people could put

[go-nuts] modules: incrementing major version when adopting modules with v2+ packages

2019-01-24 Thread thepudds1460
A brief PSA: If you are adopting modules with an existing v2+ package, the recommended best practice for most cases is to increment the major version when first adopting modules. For example, if you are on already on v2.2.0, then you would use v3.0.0 for your first release with modules.

[go-nuts] Re: [golang-dev] [security] Go 1.11.5 and Go 1.10.8 are released

2019-01-24 Thread Karl J. Smith
https://golang.org/doc/devel/release.html#go1.11.minor doesn't mention 1.11.5 yet. On Wed, Jan 23, 2019 at 1:53 PM Julie Qiu wrote: > Hi gophers, > > We have just released Go 1.11.5 and Go 1.10.8 to address a recently > reported security issue. We recommend that all users update to one of these

[go-nuts] DEDIS Lab at EPFL is hiring gophers

2019-01-24 Thread jeff . allen
DEDIS (Decentralised and Distributed Systems lab) is looking for a Security/Privacy Software Engineer . What's better than hacking Go? Hacking Go while working at a world class university? Hacking Go