Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-30 Thread robert engels
I had some previous discussions on another site :) where I suggested that when passing a slice to a method, and the method expects an interface, that the actual struct parameter is marked as “this is concrete type T but treat as interface”, etc. It really only works when the slice is “read

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-30 Thread Space A.
it's pointer that implements, so iface[i] = среда, 31 октября 2018 г., 3:30:26 UTC+3 пользователь Justin Israel написал: > > > > On Wed, Oct 31, 2018 at 11:21 AM > wrote: > >> Hello, everyone. >> Consider following code: >> >> package main >> import "fmt" >> >> type implementation struct { >>

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-30 Thread Justin Israel
On Wed, Oct 31, 2018 at 1:32 PM robert engels wrote: > I have argued for a runtime/built-in to do this - it is so common…. (if > doing “kind of OO” in Go) > I would love to have the ability to do it with built-in support, but I feel like it would go against the goals of not wanting to hide

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-30 Thread robert engels
I have argued for a runtime/built-in to do this - it is so common…. (if doing “kind of OO” in Go) > On Oct 30, 2018, at 7:30 PM, Justin Israel wrote: > > > > On Wed, Oct 31, 2018 at 11:21 AM > wrote: > Hello, everyone. > Consider following code: > > package

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-30 Thread Justin Israel
On Wed, Oct 31, 2018 at 11:21 AM wrote: > Hello, everyone. > Consider following code: > > package main > import "fmt" > > type implementation struct { > d []int} > > func (impl *implementation) getData() interface{} { > return impl.d} > > type phase struct{} > > type data interface { >

[go-nuts] go client issue with apache SSL

2018-10-30 Thread Valentin Kuznetsov
Hi, I'm experience a weird problem with Go client accessing apache SSL server. I need to authenticate my client with my X509 certificates. Here is a client code: // helper function to create a client func HttpClient() *http.Client { uckey := os.Getenv("X509_USER_KEY") ucert :=

Re: [go-nuts] Code generated by generics draft

2018-10-30 Thread Ian Lance Taylor
On Tue, Oct 30, 2018 at 8:39 AM, Jamie Clarkson wrote: > Ah ok, sorry I don't want to waste your time getting into the nitty-gritty > of a hypothetical situation but are you meaning the > code for (say): > > func (u *_UserEdge) Nodes() _SliceN { > nodes := u.UserEdge.Nodes() // type

Re: [go-nuts] Go 2 Error Handler Testing

2018-10-30 Thread Burak Serdar
On Tue, Oct 30, 2018 at 2:15 PM Liam wrote: > > I've compiled an outline of Requirements to Consider for Go 2 Error Handling. > > Recently I was asked about support for a test harness in functions that > contain error handlers; my document doesn't address this. My first guess is > that the

[go-nuts] Correct way to solve slice of interface type problem

2018-10-30 Thread zloikompot
Hello, everyone. Consider following code: package main import "fmt" type implementation struct { d []int} func (impl *implementation) getData() interface{} { return impl.d} type phase struct{} type data interface { getData() interface{}} func MakeIntDataPhase() *phase {

Re: [go-nuts] database for protobuf - profanedb or similar

2018-10-30 Thread robert engels
Just to learn Go, and do some performance tests. I had been a contributor to the Lucene project way back when, so the idea of doing a kv using LVM trees seemed like a good project - small enough in scope, but useful. I only brought it up because it is simple enough that if you want to learn Go

Re: [go-nuts] database for protobuf - profanedb or similar

2018-10-30 Thread Marko Ristin-Kaufmann
Hi Robert, I'm just curious: why did you develop yet another key/value store? Cheers Marko -- 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

Re: [go-nuts] database for protobuf - profanedb or similar

2018-10-30 Thread robert engels
Also, if you are just looking for a simple high performance key value datastore, you can look at my github.com/robaho/keydb There is also a service wrapper allowing shared access via gRPC (protobufs) at github.com/robaho/keydbr

[go-nuts] One-liner README instructions for GitHub cross compiled binary assets

2018-10-30 Thread Paul Jolly
Hi - I'm hoping someone can point me towards a "best practice" example on adding binary assets to GitHub releases of a program. Take https://github.com/myitcv/gobin/releases/tag/v0.0.2 as an example. I have added cross compiled binaries as assets to the v0.0.2 release. What I would now like

Re: [go-nuts] database for protobuf - profanedb or similar

2018-10-30 Thread Marko Ristin-Kaufmann
We are using LMDB with string or numerical keys and protobufs as values. Be careful with the encoding of numerical keys, though: complement of two is not in lexicographical order. We are almost done with open-sourcing a python/go library: https://github.com/Parquery/pynumenc (see the pull

Re: [go-nuts] Go Performance

2018-10-30 Thread robert engels
Btw, the math was off here, with 3 million vs. 5 million ops a second (and these are essentially IO ops - sending messages to the broker), the difference is 0.13 microsecs per op - or 130 nanos. Pretty insignificant for IO based tasks. > On Oct 30, 2018, at 8:10 AM, Robert Engels wrote: > >

[go-nuts] Re: Go 2 error handling non-proposal

2018-10-30 Thread Liam
Hi, could you link this thread on the Feedback wiki page (probably in the Against section)? https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback URL to this thread: https://groups.google.com/d/topic/golang-nuts/1McP4_-oOpo/discussion It seems clear that the Go team has resolved to add

[go-nuts] Go 2 Error Handler Testing

2018-10-30 Thread Liam
I've compiled an outline of Requirements to Consider for Go 2 Error Handling . Recently I was asked about support for a test harness in functions that contain error handlers; my document doesn't address this. My first

Re: [go-nuts] database for protobuf - profanedb or similar

2018-10-30 Thread Sam Whited
On Tue, Oct 30, 2018, at 13:48, Tharaneedharan Vilwanathan wrote: > I am looking for a database for protobuf, preferably the one that fits Go > environment better. I located profanedb. I am wondering if anyone tried it > with Go and if there is any example code that I can take a look at. Also, >

Re: [go-nuts] database for protobuf - profanedb or similar

2018-10-30 Thread robert engels
cockroachdb is in Go and uses protobuf to communicate - but it provides pre-built easy to use clients for many languages. > On Oct 30, 2018, at 1:48 PM, Tharaneedharan Vilwanathan > wrote: > > Hi All, > > I am looking for a database for protobuf, preferably the one that fits Go >

[go-nuts] database for protobuf - profanedb or similar

2018-10-30 Thread Tharaneedharan Vilwanathan
Hi All, I am looking for a database for protobuf, preferably the one that fits Go environment better. I located profanedb. I am wondering if anyone tried it with Go and if there is any example code that I can take a look at. Also, please let me know if there is anything else I should try too.

Re: [go-nuts] Re: Go Performance

2018-10-30 Thread Robert Engels
I already responded. The Go version requires minimal memory for optimum performance. I’m sure a lot of that is due to the buffer chaining/reuse in the implementation. Still it is an important aspect regardless for systems level tools. Additionally, the Go version requires no warm-up. For

[go-nuts] Re: Go Performance

2018-10-30 Thread Glen Newton
I would also be interested in the memory comparison. Glen On Tuesday, October 30, 2018 at 1:03:13 PM UTC, T L wrote: > > OP really should compare the memory consumptions of the Java version and > Go version. > > On Monday, October 29, 2018 at 4:53:52 PM UTC-4, robert engels wrote: >> >> Hello

Re: [go-nuts] Code generated by generics draft

2018-10-30 Thread Jamie Clarkson
Replying to myself but I've got a different method with a dictionary per type instead of the interface per value: iv) Dictionary based: https://play.golang.org/p/t6GBTEgq_g6 (that one based on reflect but could use the slice interfaces or similar) On Tuesday, October 30, 2018 at 3:39:09 PM

[go-nuts] Re: Go Performance

2018-10-30 Thread robert engels
Btw, if anyone is running comparison tests. I used a 3.4 ghz iMac with i7 (4 cores, 8 threads). The tests were all on the local machine (no physical networking involved). With both Go and Java, the CPU appears to be saturated - which is expected. > On Oct 29, 2018, at 3:53 PM, robert engels

[go-nuts] Re: Go Performance

2018-10-30 Thread robert engels
Btw, with some minor code updates, and using the new GraalVM (http://www.graalvm.org ) the Java numbers improved to: without SSL, 4300k msgs per sec Running GraalVM with SSL is VERY slow - 270k msgs per second - looks like a bug. Also, the latest code (running under

Re: [go-nuts] Code generated by generics draft

2018-10-30 Thread Jamie Clarkson
Ah ok, sorry I don't want to waste your time getting into the nitty-gritty of a hypothetical situation but are you meaning the code for (say): func (u *_UserEdge) Nodes() _SliceN { nodes := u.UserEdge.Nodes() // type []UserNode return _SliceUserNode(nodes) } ? On Tuesday, October 30,

Re: [go-nuts] Re: Go Performance

2018-10-30 Thread robert engels
I did provide the details. It is using the ‘bench’ test program provided with Nats (it is a Go client). It can be configured for multiple producers and consumers. It was run with only a single producer and no consumer. I am in the process of running the tests with a single producer and single

[go-nuts] Re: Go Performance

2018-10-30 Thread Space A.
You didn't provide any details on the tests. But I think the idea was same as usual - send some "Hello world" over network. If so all these numbers have nothing to do with real world. PS: ofc this doesn't mean that something is more or less performant than the other. понедельник, 29 октября

Re: [go-nuts] Code generated by generics draft

2018-10-30 Thread Ian Lance Taylor
On Tue, Oct 30, 2018 at 8:15 AM, Jamie Clarkson wrote: > > I'm not sure what you meant by conversion of non-interface to interface > types to handle results? I can see the usual conversions working fine at > the call site for input parameters but the actual ShortestPath func seems to > need to

Re: [go-nuts] Code generated by generics draft

2018-10-30 Thread Jamie Clarkson
Thanks Ian, I appreciate none of this has been implemented, just trying to understand the design space (including what the generated code will look like and how to get from the input contract definition & generic to the output code :) ). Also I realize that the compiler is free to do all

Re: [go-nuts] Re: Go Performance

2018-10-30 Thread robert engels
To achieve similar performance numbers as reported, the resident Java memory size was 96 MB, while the Go was 14 MB. Again very impressive for Go. > On Oct 30, 2018, at 8:11 AM, Robert Engels wrote: > > I will do so and report back. > > On Oct 30, 2018, at 8:03 AM, T L

Re: [go-nuts] Code generated by generics draft

2018-10-30 Thread Ian Lance Taylor
On Tue, Oct 30, 2018 at 6:13 AM, Jamie Clarkson wrote: > > Apologies if this is covered somewhere, have searched and not found. > > I'm curious about the Go2 generics draft, how does the team envisage the > code generated for the ShortestPath (without code expansion like C++ > templates where

[go-nuts] Re: Go Performance

2018-10-30 Thread gerrit . jansen_van_vuuren
yeah, Java comes from a different school of thought/history etc, where most things are done via frameworks and libs. The idiomatic way of doing something in Java (imho) is to get an already optimized lib and tested framework, and Java makes this easy for you via many build tools like

[go-nuts] Code generated by generics draft

2018-10-30 Thread Jamie Clarkson
Hi gophers, Apologies if this is covered somewhere, have searched and not found. I'm curious about the Go2 generics draft, how does the team envisage the code generated for the ShortestPath (without code expansion like C++ templates where it's obvious)? I can come up with two so far. i)

Re: [go-nuts] Re: Go Performance

2018-10-30 Thread Robert Engels
That is nonsense. There are more scattered Go modules duplicating functionality in Go than just about anything other than JS. Nats may not use them, but everyone else does. There are probably 3 competing libraries just for error handling... > On Oct 30, 2018, at 8:03 AM, T L wrote: > > OP

Re: [go-nuts] Go Performance

2018-10-30 Thread Robert Engels
I’ve written lots of network service code. I understand what’s available. Actually, for a small number of clients threads are faster than async/nio. In this case there is only a single active thread during the test. The main benefit of using nio is that you can avoid the java space to native

[go-nuts] Re: Go Performance

2018-10-30 Thread T L
OP really should compare the memory consumptions of the Java version and Go version. On Monday, October 29, 2018 at 4:53:52 PM UTC-4, robert engels wrote: > > Hello Gophers, > > I’ve been chastised in the past regarding some of my Go performance tests > - using Java as a baseline. In most of

[go-nuts] Re: Go Performance

2018-10-30 Thread T L
On Tuesday, October 30, 2018 at 8:39:03 AM UTC-4, Gerrit Jansen van Vuuren wrote: > > Some notes on your java impl: > > You really want to use a framework for handling the connections and > threading, its tricky in java. > Your current implementation creates 2 new threads on each connection

[go-nuts] Re: Go Performance

2018-10-30 Thread ffm2002
I recommend to change the Java version to make use of Netty (netty.io). Netty contains a lot of network knowledge to speed up things. -- 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

[go-nuts] Go Performance

2018-10-30 Thread gerrit . jansen_van_vuuren
Some notes on your java impl: You really want to use a framework for handling the connections and threading, its tricky in java. Your current implementation creates 2 new threads on each connection which is wasteful and very expensive. For threading please see:

Re: [go-nuts] How to get current goroutine id?

2018-10-30 Thread Max
I agree on the fact that passing a Context everywhere is impossible in some cases - just think about the many APIs (from standard library and 3rd parties) that do not accept a Context - and in some other cases very complicated, requiring extensive refactoring. I also agree with the

Re: [go-nuts] Re: Regarding contracts

2018-10-30 Thread hay
Hi, Regarding support for contracts in Go, please take a look at this: https://www.youtube.com/watch?v=HOl11mP4V68 Kind regards, -- 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