[go-nuts] Re: golang cpu usage question

2017-03-27 Thread 刘桂祥
my production program data: ... gc 149 @91.330s 6%: 6.8+557+0.50+1.0+10 ms clock, 20+557+0+1841/0/1304+31 ms cpu, 3694->3793->2016 MB, 3789 MB goal, 48 P gc 150 @92.012s 6%: 2.9+505+0.32+0.58+9.5 ms clock, 11+505+0+1756/0.014/1574+38 ms cpu, 3739->3805->1987 MB, 3835 MB goal, 48 P gc 151 @92.632s

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread Dave Cheney
Or to answer​ your question another way; the more allocations your program performs, the​ higher the GC overhead to clean them up. Are you asking: is there a way to limit the % CPU the GC is allowed to use? If so, the answer is no, because: 1. If the GC doesn't keep up with the garbage your pro

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread Dave Cheney
I'm not sure what you expected to see. That program does nothing but generate garbage. It's going to have a high overhead to clean up that garbage. Can you show some data from your real program? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread 刘桂祥
package main import ( "fmt" "time" ) func foo() { str := "" for i := 0; i < 1000; i++ { str += "aa" } } func main() { for i := 0; i < 200; i++ { go func() { for {

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread Dave Cheney
I suggest two things 1. Post the GODEBUG output here, someone will be able to confirm how much time they GC is using. 2. Use github.com/pkg/profile to generate an execution trace and analyse it with go tool trace. -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Algorithm Club

2017-03-27 Thread Will Faught
Something I've never seen addressed in the generics tradeoffs debate (not saying it hasn't been, but I haven't see it personally) is that without generics, you're forced to use interface{}, which just boxes the values anyway. So you're already paying a performance cost for type-agnostic code wi

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread 刘桂祥
now In my application 48 core set GODEBUG=gctrace=1 the gc CPU percent is 17% but my server request have many long time case want to know the CPU percent in witch percentage is hight?? 在 2017年3月27日星期一 UTC+8下午6:55:47,Dave Cheney写道: > > > > On Monday, 27 March 2017 21:12:44 UTC+11, 刘桂祥 wrote:

Re: [go-nuts] Re: Go -> C++ transpiler idea: Miracle child or horrible abomination?

2017-03-27 Thread Brad
Thanks, yes I'm casually familiar with both projects but will dig deeper. It's true that some big parts of what I'm describing have already been done, targeting other languages. On Monday, March 27, 2017 at 6:42:27 PM UTC-7, Andrew Chambers wrote: > > I suggest looking at the prior art of gophe

Re: [go-nuts] Re: Go -> C++ transpiler idea: Miracle child or horrible abomination?

2017-03-27 Thread Andrew Chambers
I suggest looking at the prior art of gopherjs and Elliot stonehams haxe based transpiler. On 28/03/2017 2:19 PM, "Brad" wrote: > Thanks for all feedback here. It sounds like while there are some > significant caveats this could work and would have value. I think the big > question is what are

[go-nuts] Re: Go -> C++ transpiler idea: Miracle child or horrible abomination?

2017-03-27 Thread Brad
Thanks for all feedback here. It sounds like while there are some significant caveats this could work and would have value. I think the big question is what are all these integration points that are provided by the Go runtime that are not available in a C/C++ environment and how big of a task

Re: [go-nuts] dep: Roadmap for merging into the toolchain

2017-03-27 Thread Russ Cox
On Mon, Mar 13, 2017 at 5:09 PM, Russ Cox wrote: > By far the most important things to do with dep right now are (1) build > something people can use and get benefit from today and eliminate blockers > to adoption and (2) based on experience with that usage, learn what the > eventual design and g

[go-nuts] [ANN] New (alpha) version of Vermeer Light Tools released

2017-03-27 Thread Jamie Clarkson
Hi Gophers, I've just released a new (alpha) version of Vermeer Light Tools, a physically plausible renderer written in Go. Check it out: https://github.com/jamiec7919/vermeer . A few new features in this release including more advanced anisotropic texture filtering, multiple importance sam

[go-nuts] Reading Json file from s3 and want to keep all values in-memory structure.

2017-03-27 Thread hunt
Hi, Just wanted to know how can i achieve this. -- 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. For more options, visit

[go-nuts] Re: go-swagger dynamic API creation

2017-03-27 Thread Matt Ho
Before writing github.com/savaki/swag, I gave goswagger a try. I think goswagger is a fantastic library with lots of useful features. However, for my own use, I found things like: var findTodos = runtime.OperationHandlerFunc(func(params interface{}) (interface{}, error) { log.Println("rec

[go-nuts] go-swagger dynamic API creation

2017-03-27 Thread Johann Höchtl
The last time I used it swagger was called swagger. Lots has changed since it's OpenAPI. A huge framework evolved around it https://goswagger.io/ I really like the approach of defining the API entirely dynamically in code (and announcements like https://groups.google.com/forum/#!topic/golang-n

[go-nuts] Full Mustache Implementation Released

2017-03-27 Thread mreriklott
Hey Go devs, I've just released a full go implementation of the Mustache template language at https://github.com/eriklott/mustache . This library covers (and is tested against) the full Mustache spec, including partials and lambdas, etc. Feedback and bug reports welcome. -- You received this

Re: [go-nuts] Re: [ANN] Go geospatial libraries: geometries, GeoJSON, WKB, KML, PostGIS, GPX, polyline

2017-03-27 Thread Tom Payne
Here's an example: 8< package main import ( "log" "os" enckml "github.com/twpayne/go-geom/encoding/kml" "github.com/twpayne/go-geom/encoding/wkbhex" "github.com/twpayne/go-kml" ) func main() { g, err := wkbhex.Decode("0140004010") if err != nil { log.Fata

Re: [go-nuts] Re: Algorithm Club

2017-03-27 Thread David Collier-Brown
I can't speak to the staging process, but I became all too aware of how to cause cache misses on a SPARC (:--) In a mature, sane and well-debugged program, write #define debug() macros so they always caused a cache miss even when not turned on, then sprinkle enthusiastically throughout all the

Re: [go-nuts] Re: Algorithm Club

2017-03-27 Thread Jesper Louis Andersen
In addition, there are also the notion of "staging meta-compilation" as witnessed in e.g., BER-MetaOCaml. The idea is that if you want the best program efficiency, no compiler is able to carry out the needed optimizations. So you start meta-compiling by staging the compiler and generating code at

[go-nuts] Re: [ANN] Go geospatial libraries: geometries, GeoJSON, WKB, KML, PostGIS, GPX, polyline

2017-03-27 Thread Constantine Vassilev
How to use go-geom to convert WKBHEX to KML? Are there a simple example? On Sunday, November 13, 2016 at 10:33:27 AM UTC-8, Tom Payne wrote: > > A quick announce of a few libraries for geospatial applications that are > now mature and battle-tested: > > https://github.com/twpayne/go-geom : effic

[go-nuts] [ANN] swag, a lightweight library to generate swagger definitions that works with any web framework

2017-03-27 Thread Matt Ho
Here's a library that I've used for a while to handle generating the server side swagger definition. I recently cleaned it up and thought I would share: https://github.com/savaki/swag Unlike other swagger tools, swag works with any web framework and doesn't require any code generation. E

[go-nuts] JSON empty slice and/or empty set encoding question/proposal

2017-03-27 Thread traetox
Hello all, I have swept through the list and gone through the pkg/encoding/json package and _believe_ I haven't missed anything, but am not 100% sure. When encoding structures into JSON which contain slices/arrays/maps my frontend devs consistently complain about the encoding of empty or nil m

Re: [go-nuts] x/mobile: Difficulty getting images with transparencies with example apps

2017-03-27 Thread drjrieke
Thanks Daniel. :) -- 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. For more options, visit https://groups.google.com/d/o

Re: [go-nuts] Is it possible to do syscall sendfile() upon http client?

2017-03-27 Thread Ian Lance Taylor
On Mon, Mar 27, 2017 at 3:18 AM, wrote: > > For example, I have a big file, let's say 100 GB, and I need to post it to > some http server. > > Could I use sendfile() upon the http client? Then I would not need to copy > the file content into user space before sending it. > > It seems that the htt

[go-nuts] Is it possible to do syscall sendfile() upon http client?

2017-03-27 Thread luajit . io
Hi All, For example, I have a big file, let's say 100 GB, and I need to post it to some http server. Could I use sendfile() upon the http client? Then I would not need to copy the file content into user space before sending it. It seems that the http lib do not export the underlying tcp connec

[go-nuts] undefined error when run 'go install', src codes attached, thanks

2017-03-27 Thread jimy
Hi, The codes are to send data, main func is in 'test_tool.go', calling ParsingXml function is fine. but calling GetRemotePort, GetRemoteIp, GetProtocol, GetSendData is wrong: "./test_tool.go:67: undefined: GetRemotePort". BR, Wei Yan -- You received this message because you are subscrib

Re: [go-nuts] Best practice for Method Receivers

2017-03-27 Thread Ayan George
On 03/24/2017 09:20 PM, st ov wrote: > Is it idiomatic to mix-&-match pointer and value method receivers for > a given type? or in *_general_*, if a single method requires a > pointer receiver than *all methods* should take a pointer, regardless > if a value receiver is appropriate? > > For exa

[go-nuts] Re: Best practice for Method Receivers

2017-03-27 Thread Val
Hello st ov What do you mean with "even though a value receiver would be acceptable" ? Your sample code clearly shows that after foo.SetVal(1) , we still have foo.val == 0 which looks unacceptable to me (broken setter). Is it possible that you are confusing "is the method receiver a reference

Re: [go-nuts] Re: Unsafe string/slice conversions

2017-03-27 Thread Jerome Froelich
It seems the issue has to do with the compiler inlining `foo`. If I add the compiler directive `//go:noinline` above `foo` and run `go test` the test fails, just like when I run `go test -covermode=atomic`. This makes sense because if the function is inlined and the slice is allocated on the sta

Re: [go-nuts] Re: Algorithm Club

2017-03-27 Thread David Collier-Brown
Folks, is this something that we should do with a template processor? More topically, is this a set of somethings that we should prototype each of, using templates? I'd love to see actual experiments in computer "science" (;-)) and a debate about the tradeoffs based on code. --dave On Monda

Re: [go-nuts] Re: Algorithm Club

2017-03-27 Thread Michael Jones
Another dimension is "intellectual complexity." Where that is smaller, everything else is better for coding, documenting, debugging, testing, reading, using, and maintaining. It is a critical measure for maintaining the 'Go' of Go. On Sun, Mar 26, 2017 at 11:40 PM Egon wrote: > On Monday, 27 Ma

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread Dave Cheney
On Monday, 27 March 2017 21:12:44 UTC+11, 刘桂祥 wrote: > > Hi Dave: >very thanks your timely response >two more question >1. GODEBUG=gctrace=1 Do have some method get these quota from > runtime package apis ? > no >2. In go1.7 the concurent gc could oc

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread 刘桂祥
Hi Dave: very thanks your timely response two more question 1. GODEBUG=gctrace=1 Do have some method get these quota from runtime package apis ? 2. In go1.7 the concurent gc could occupy all cpu core ?? does it have cpu usgae limit ? 在 2017年3月27日星期一

[go-nuts] golang cpu usage question

2017-03-27 Thread Dave Cheney
You can enable monitoring of the gc with this environment variable GODEBUG=gctrace=1 The format of the output is described on this page. https://golang.org/pkg/runtime/ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this g

[go-nuts] gomobile build ios app fail

2017-03-27 Thread hui zhang
the gomobile wiki do not mention how to solve ios signing properly , only with a link that can not open. https://github.com/golang/go/wiki/Mobile Note: target=ios requires the host machine running OS X. You need to obtain a signing identity and download provisioning profiles

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-27 Thread Paul Jolly
Of course you don't need to us go/ast for output (it's very likely used heavily when working out what to generate based on Go source input) - I generally create some simple helper types that wrap a bytes.Buffer, generate most code using text/template into said buffer, format using golang.org/x/tool

[go-nuts] Re: template Funcs with ParseFile and Execute

2017-03-27 Thread Lee McLoughlin
Perhaps I'm missing something in the documentation but I think this shows something odd happening when the name in New() and the first filename in ParseFiles() do not match: package main import ( "fmt" "html/template" "log" "os" ) // x.tpl contains just one line

[go-nuts] golang cpu usage question

2017-03-27 Thread 刘桂祥
As we know go have optimise its gc stw-pause-time ,but it has some trade-off ; it implements concurent gc and will grab cpu resources with your application In some high CPU usage application, there are long time request case caused by gc I want to know How to monitor my application in CPU usa

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-27 Thread Henry
Actually, it would be quite nice to simplify the Go's AST package and makes it simpler for people to develop custom code generation and tools. I use code generation quite a lot, eg. to generate data-access code, etc., but the process of creating one requires some effort to get right. I think go