[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

[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

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

[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

[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,

[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) {

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 {

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] 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

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

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. > >

[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

[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

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

[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

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

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

[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

[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 ? 在

[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

[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

[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

[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

[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

Re: [go-nuts] Re: Algorithm Club

2017-03-27 Thread Egon
On Monday, 27 March 2017 04:06:17 UTC+3, Mandolyte wrote: > > I agree that it makes the suitable trade-offs. And Linq is doing pretty > well without generics (https://github.com/ahmetb/go-linq); not familiar > with Rx. > > When I consider the dilemma, the two things I don't want are slow >