[go-nuts] some questions to use ScalarMult

2017-05-31 Thread 张伟
I am using ECC ScalarMult to get a point. When I use the amd64 accelerated version, the result is wrong; by using the generic version, the result is normal. My code is here: k, _ := hex.DecodeString("646d22e7aee42d44bd15cdf58006359283e1da83c2670b25d44906d03e9ed4eb") X, _ :=

Re: [go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread robfig
We do this exact thing except using closure templates https://blog.gopheracademy.com/advent-2014/soy-programmable-templates/ -- 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

Re: [go-nuts] Windows - syscall.GetProcessTimes() always shows 0 values.

2017-05-31 Thread kevin . michael . lloyd
Steven, your example is really helpful! I didn't know Windows had a lower time interval for internal timers, so that's good to know, thanks for getting me unstuck! Thought I was losing my mind. Is there a reason to pass the PID around instead of using the pseudo handle? I'm new to the core

Re: [go-nuts] Windows - syscall.GetProcessTimes() always shows 0 values.

2017-05-31 Thread Steven Hartland
Your main problem is the fact that the Windows time interval is 16ms by default. It uses this value for its internal timers and thread time quantum, which effectively means you won't see any changes until they have added up to a min of 16ms. You can see this by changing the 16ms in the following

[go-nuts] Re: [ANN] githubql—a client library for accessing GitHub GraphQL API v4

2017-05-31 Thread Dmitri Shuralyov
Wow, it would probably help if I linked to the actual package (although it seems Google-able from the name alone): https://github.com/shurcooL/githubql On Wednesday, May 31, 2017 at 3:55:13 PM UTC-4, Dmitri Shuralyov wrote: > > This package is very new, I've just created it a few days ago

Re: [go-nuts] Re: To panic or not to panic, that's the question

2017-05-31 Thread Henrik Johansson
Yes those I also use in init sometimes but then you are in control of your templates and regexes and things usually blow up quickly during development which makes you fix it promptly. It is not quite the same though as I understood Peters question to be. The analogy would be the html/template to

[go-nuts] [ANN] githubql—a client library for accessing GitHub GraphQL API v4

2017-05-31 Thread Dmitri Shuralyov
This package is very new, I've just created it a few days ago after a week of research and prototyping. Feedback is welcome. If you're interested in the details of its design evolution and the various approaches I've considered, I wrote a lengthy comment at

Re: [go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread Michael Brown
And after I re-read your answer, I realize that I probably just restated very badly what you wrote, Egon. Thanks! I'll have some time this evening to hack on it. On Wednesday, May 31, 2017 at 2:51:51 PM UTC-5, Michael Brown wrote: > > Ah! I think I have the kernel of a usable idea here. Thanks.

Re: [go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread Michael Brown
Ah! I think I have the kernel of a usable idea here. Thanks. How does this sound: template 1 outputs template 2. Input to template 1 kicks off the goroutines and places {{ get_results token_xyz }} as the output, but also has an output channel that we can wait on for all of the answers Then,

[go-nuts] Re: To panic or not to panic, that's the question

2017-05-31 Thread Pierre Durand
I use these functions in init(): https://golang.org/pkg/html/template/#Must https://golang.org/pkg/regexp/#MustCompile Le mercredi 31 mai 2017 21:24:58 UTC+2, Peter Kleiweg a écrit : > > If a package can't be used because some precondition can't be fulfilled, > you can use a panic. Then the

Re: [go-nuts] To panic or not to panic, that's the question

2017-05-31 Thread Henrik Johansson
Init seems very harsh, how can you ensure proper configuration then? Otherwise I don't mind oanics during object creation or explicit initialization. Panics in mid execution less so but parhaps there are cases where it is warranted. ons 31 maj 2017 kl 21:25 skrev Peter Kleiweg

[go-nuts] To panic or not to panic, that's the question

2017-05-31 Thread Peter Kleiweg
If a package can't be used because some precondition can't be fulfilled, you can use a panic. Then the whole program will crash at start-up. The alternative would be to not panic in the init, but have all function calls return an error. If the package is used in a large program, part of it may

Re: [go-nuts] Latency spike during GC

2017-05-31 Thread Rick Hudson
gc 347 @6564.164s 0%: 0.89+518+1.0 ms clock, 28+3839/4091/3959+33 ms cpu, 23813->23979->12265 MB, 24423 MB goal, 32 P What I'm seeing here is that you have 32 HW threads and you spend .89+518+1 or 520 ms wall clock in the GC. You also spend 28+3839+4091+3959+33 or 11950 ms CPU time out of total

Re: [go-nuts] Re: Using Context to store TraceIDs

2017-05-31 Thread Jesper Louis Andersen
In Erlang, we have a similar concept to the Context bag called the Process Dictionary. Its use is generally a nono because it breaks the rules for functional programming and allows you to have a shared space. We like to pass every argument explicitly in order to make it easier to read the code.

Re: [go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread Michael Brown
This is almost certainly going to be a case where you have the correct solution and I don't have the go experience to properly understand it. I wasn't quite understanding how your code was "patching" the results and how the template package knows to wait for it. Let me describe my problem. I

[go-nuts] Re: Using Context to store TraceIDs

2017-05-31 Thread Daniel Theophanes
Hi Bill, Generally if you have a Trace ID, you are also doing something that involves multiple systems, processes, or routines. If that is the case, you also need a way to cancel your resource. Thus Trace ID is included with values in the context and not separated. When Dave voiced his own

Re: [go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread Egon Elbre
Both of my described approaches run the funcs serially however it does not wait for the response and later patxhes the results. Can you describe the whole thing you are building? Piecing the requirements and purpose together from comments is difficult. I.e. how much memory, how big is request

[go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread Michael Brown
The best thing I can think of is to modify text/template to add futures support, and then do multi-pass rendering. The place to add this looks relatively simple, however the implementation looks complicated (and I just wrote my first program in go a couple weeks ago...) The problem that I see

Re: [go-nuts] How to parallelize text/template long running functions?

2017-05-31 Thread Michael Brown
This is basically the answer that everybody gives, however this is just not an option. (Which also makes this a very frustrating question to ask, as many people insist that you are just simply wrong for asking it without any understanding of our requirements.) We have data sets that we cannot

Re: [go-nuts] Latency spike during GC

2017-05-31 Thread Ian Lance Taylor
[ +rlh, austin ] Which version of Go are you running? Ian On Tue, May 30, 2017 at 10:01 PM, Xun Liu wrote: > Hi, we see a clear correlation between GC and latency spike in our Go > server. The server uses fairly large amount of memory (20G) and does mostly > CPU work. The

[go-nuts] Re: How to parallelize text/template long running functions?

2017-05-31 Thread Egon
The best idea I can think of (without digging and modifying text/template) is to use special tokens and replace them afterwards... Of course this approach has limitations in what it can do. *// note: code untested and incomplete* type Token string type Queries struct { pending

[go-nuts] Latency spike during GC

2017-05-31 Thread Xun Liu
Hi, we see a clear correlation between GC and latency spike in our Go server. The server uses fairly large amount of memory (20G) and does mostly CPU work. The server runs on a beefy box with 32 cores and the load is pretty light (average CPU 20-30%). GC kicks in once every 10-20 seconds and

[go-nuts] Re: Getting IP Address AND Hardware Address in golang...

2017-05-31 Thread koti . kelam
How to set ip address to a given interface? is there any built-in function or reference implementation? On Sunday, 15 December 2013 15:00:02 UTC+5:30, Curtis Paul wrote: > > Any ideas on how to list all of the local IP Address and Hardware > Addresses? > > I understand the following, it

[go-nuts] How to parallelize text/template long running functions?

2017-05-31 Thread Michael Brown
I am designing a system that will heavily use text/template processing and I've run into one issue that is going to be a show stopper for me if I can't figure out a way around it. Execute() on a template will run all of the functions in the template serially. For example, when you run the

[go-nuts] Re: did anyone tried // template exec ?

2017-05-31 Thread Michael Brown
My problem is that I have a very large data set that is very expensive (memory/compute) to get, and only the template knows which data it needs to use. Computing the data in go before template processing would waste a whole lot of time/memory that I dont have. On Tuesday, May 30, 2017 at