Re: [go-nuts] fast small prime checker

2018-03-04 Thread Michael Jones
...if that's how you feel, you'll enjoy the current discussion of vgo. On Sun, Mar 4, 2018 at 10:24 PM, wrote: > > > On Monday, 5 March 2018 02:13:18 UTC-4, Jan Mercl wrote: >> >> >> On Mon, Mar 5, 2018 at 12:55 AM wrote: >> >> > For my use case,

Re: [go-nuts] Memory copy on return statement (copy elision)

2018-03-04 Thread Ian Lance Taylor
On Sun, Mar 4, 2018 at 5:57 AM, Bruno Novais wrote: > > As you probably noticed by my question, I'm new to this awesome language > called Go (coming from C/C++). In C++ I rely a lot on constructor (copy) > elision. I think Go doesn't have this concept, but I would like to

Re: [go-nuts] fast small prime checker

2018-03-04 Thread ralphdoncaster
On Monday, 5 March 2018 02:13:18 UTC-4, Jan Mercl wrote: > > > On Mon, Mar 5, 2018 at 12:55 AM > wrote: > > > For my use case, I'll only be checking numbers > 2^18 and < 2^25. After > looking at the repo, it's not simple enough to copy primes.go, anyone that > wants to

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Jan Mercl
On Mon, Mar 5, 2018 at 12:55 AM wrote: > For my use case, I'll only be checking numbers > 2^18 and < 2^25. After looking at the repo, it's not simple enough to copy primes.go, anyone that wants to rely on it would have to fork the repo. No need to copy source code or

[go-nuts] $PATH error.

2018-03-04 Thread Dave Cheney
Under the hood go get shells out to git to fetch source code. You need to install git. -- 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

[go-nuts] $PATH error.

2018-03-04 Thread danilopaesdesouza
Hello guys. I'm very raw in GoLang but I found it amazing until now. I were making the tutorials described in GoLang website and I'm stuck in a problem. When using "go get github.com/golang/examples/hello" I'm getting the following error: "go: missing Git command. See

[go-nuts] Go Games

2018-03-04 Thread Chris FractalBach
I'm still new to Go, and have been writing server code to support a multiplayer game. After reading the Go 2017 Survey Results , I noticed the result* "I work in the following areas: Gaming"* had 5% respondents. I am curious about general interest

Re: [go-nuts] fast small prime checker

2018-03-04 Thread ralphdoncaster
On Sunday, 4 March 2018 17:07:20 UTC-4, Jan Mercl wrote: > > On Sun, Mar 4, 2018 at 9:38 PM wrote: > > > The performance looks to be as good or slightly better than my simple > implementation. > > FTR, the performance is in an order of magnitude, or as you put it >

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Bakul Shah
> On Mar 4, 2018, at 1:40 PM, Bakul Shah wrote: > > >> On Mar 4, 2018, at 12:43 PM, ralphdoncas...@gmail.com wrote: >> >> I am curious to see how you implemented the table lookup. Is the code >> posted somewhere? > > This should easy. Check all odd numbers against

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Michael Jones
indeed. i never uploaded that to github. but i could. will look into it. On Sun, Mar 4, 2018 at 1:40 PM, Bakul Shah wrote: > > > On Mar 4, 2018, at 12:43 PM, ralphdoncas...@gmail.com wrote: > > > > I am curious to see how you implemented the table lookup. Is the code >

Re: [go-nuts] Alibaba Cloud hash released official Go SDK v1.0.0

2018-03-04 Thread Dan Kortschak
Apart from the README, there is AFAICS no documentation. https://goreportcard.com/report/github.com/aliyun/alibaba-cloud-sdk-go#golint On Fri, 2018-03-02 at 13:53 +, Henrik Johansson wrote: > I am sure it's really cool but the docs are in chinese I assume. Most > other > projects speared by

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Bakul Shah
> On Mar 4, 2018, at 12:43 PM, ralphdoncas...@gmail.com wrote: > > I am curious to see how you implemented the table lookup. Is the code posted > somewhere? This should easy. Check all odd numbers against primes <= square root of the candidate number and if prime, add it to primes list.

Re: [go-nuts] Memory copy on return statement (copy elision)

2018-03-04 Thread andrey mirtchovski
Use 'go build -gcflags="-m"' to see what inlining actions the compiler takes. more here: https://github.com/golang/go/wiki/CompilerOptimizations#escape-analysis-and-inlining for example this https://play.golang.org/p/QyAauePKbn- will result in: $ go build -gcflags='-m' t.go #

Re: [go-nuts] Channels vs Actors

2018-03-04 Thread Bakul Shah
Messages get sent to an actor's address and only that actor “reads” from that mailbox. And there is no buffering. Channels don’t run any logic (like an actor), they may be buffered and any goroutine with access to a channel may read from it. All goroutines run in the same address space. As actors

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Jan Mercl
On Sun, Mar 4, 2018 at 9:38 PM wrote: > The performance looks to be as good or slightly better than my simple implementation. FTR, the performance is in an order of magnitude, or as you put it "slightly", better in the case of uint32 - and probably several orders of

Re: [go-nuts] fast small prime checker

2018-03-04 Thread ralphdoncaster
For my application (an ethereum miner), the prime check is only necessary when generating a cache and DAG, which is about every 5 days (or every time the miner application is restarted). I am curious to see how you implemented the table lookup. Is the code posted somewhere? On Sunday, 4 March

Re: [go-nuts] fast small prime checker

2018-03-04 Thread ralphdoncaster
On Sunday, 4 March 2018 05:41:53 UTC-4, Jan Mercl wrote: > > On Sun, Mar 4, 2018 at 7:27 AM wrote: > > > It still has room for optimization, but it is much faster than > ProbablyPrime(0) for 32-bit integers. > > >

[go-nuts] Re: Code your own blockchain mining algorithm in Go

2018-03-04 Thread ralphdoncaster
On Sunday, 4 March 2018 15:55:41 UTC-4, an...@mycoralhealth.com wrote: > > Hi everyone, I wrote a blog post showing you how to write up your own > Proof of Work algorithm in Go. Feedback welcome! > https://medium.com/@mycoralhealth/code-your-own-blockchain-mining-algorithm-in-go-82c6a71aba1f >

[go-nuts] Memory copy on return statement (copy elision)

2018-03-04 Thread Bruno Novais
Hello Gophers! As you probably noticed by my question, I'm new to this awesome language called Go (coming from C/C++). In C++ I rely a lot on constructor (copy) elision. I think Go doesn't have this concept, but I would like to know what happen when I do something like this: func NewStuff()

[go-nuts] Code your own blockchain mining algorithm in Go

2018-03-04 Thread andy
Hi everyone, I wrote a blog post showing you how to write up your own Proof of Work algorithm in Go. Feedback welcome! https://medium.com/@mycoralhealth/code-your-own-blockchain-mining-algorithm-in-go-82c6a71aba1f -- You received this message because you are subscribed to the Google Groups

[go-nuts] Channels vs Actors

2018-03-04 Thread Anto Aravinth
Hello All, I'm new to golang and trying to understand the difference between channels and actors. From my knowledge: 1. Golang support channels, which is concurrently safe 2. Channels can be shared across goroutines that are running. (very much similar to messages) Actors: 1. They are based

Re: [go-nuts] Re: General question: complex search form and query params

2018-03-04 Thread matthewjuran
> > Unless I'm misunderstanding something, that kind of string concatenation > looks dangerous to me. This approach may be error prone so testing is important but I believe the database/sql placeholders avoid any SQL injection. Here the caller also has responsibility to validate the input

[go-nuts] Re: [Question]: Are there any plans to teach the compiler to emit VEX encoded instructions ?

2018-03-04 Thread Juliusz Chroboczek
>> I believe using the non-destructive 3 operand form will help a lot in >> reducing the size of binaries. > We would have to make a clear decision as to the oldest amd64 > processor we wanted to support. Right now I believe we support all > amd64 processors. Are we ready to give up on old

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Michael Jones
ProbablyPrime() is for when the number is too big to test authoritatively. For numbers smaller than that, there are two schools of thought. The first is to do what you did, doing a primality test for the number at hand. The second is to use a table of results.The table generally needs to be of

Re: [go-nuts] High precision timer data?

2018-03-04 Thread James Chacon
I think that was the case for 1.9 definitely. As of 1.10 Darwin is the fastest by far. Even on bare metal my linux tests are taking 100ns to compute time.Now vs 11ns on an average OS/X laptop. As I mentioned the main constraint at this point is the overhead to run a time.Sleep() which is steep.

Re: [go-nuts] fast small prime checker

2018-03-04 Thread Jan Mercl
On Sun, Mar 4, 2018 at 7:27 AM wrote: > It still has room for optimization, but it is much faster than ProbablyPrime(0) for 32-bit integers. > http://nerdralph.blogspot.ca/2018/03/fast-small-prime-checker-in-golang.html You may want to give the primality checking