Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-21 Thread Matt Harden
On Fri, Apr 21, 2017 at 12:43 AM Ian Davis wrote: > > > > On Fri, 21 Apr 2017, at 03:31 AM, Ivan Kurnosov wrote: > > @Rob, > > honestly to me they look the same: > > > func IsSorted(data Interface) bool { > n := data.Len() > for i := n - 1; i > 0; i-- { > if data.Less(i, i-1) { >

Re: [go-nuts] Zero value of the map

2017-04-21 Thread Matt Harden
I can't speak for real-world speed, but algorithms with similar asymptotic complexity exist that work with immutable data. The hash map is not the only possible map implementation. Example from Haskell: http://hackage.haskell.org/package/containers-0.5.10.2/docs/Data-Map-Strict.html On Wed, Apr 19

Re: [go-nuts] Re: Semicolons in Go

2017-04-21 Thread Matt Harden
a = ( b + c + d * e ) On Thu, Apr 20, 2017 at 1:24 PM John McKown wrote: > On Thu, Apr 20, 2017 at 12:20 PM, Michael Jones > wrote: > >> >> On Thu, Apr 20, 2017 at 8:27 AM, wrote: >> >>> If I can't format my programs the way I want, and I much prefer putting >>> operato

Re: [go-nuts] doubt about sync.NewCond

2017-04-21 Thread Matt Harden
There is no guarantee that any of your goroutines will execute even Lock(), much less Wait(), before the main goroutine executes Broadcast(). On Thu, Apr 20, 2017 at 8:39 PM Allan wrote: > I run a demo program to learn sync.NewCond: > > package main > > import ( >"fmt" >"sync" >"time

Re: [go-nuts] Re: go test: no tests to run

2017-04-21 Thread Tong Sun
I'm afraid that you are wrong at both points. - tests needn't have to use the the *same *package name, in this case *package pybr *is good, but *package pybr_test *is good as well. - func TestXxx is not the only signature allowed, see https://golang.org/pkg/testing/#hdr-Examples but thanks for yo

Re: [go-nuts] Large GC pauses with large map

2017-04-21 Thread andrey mirtchovski
> amazing, Thank you for that detailed breakdown! when one does something for a long time and understands the system well they develop an intuition for where the problems may lie. this is true in every profession... -- You received this message because you are subscribed to the Google Groups "g

Re: [go-nuts] Large GC pauses with large map

2017-04-21 Thread st ov
amazing, Thank you for that detailed breakdown! On Friday, April 21, 2017 at 10:08:02 AM UTC-7, Jesper Louis Andersen wrote: > > On Fri, Apr 21, 2017 at 5:58 PM st ov > > wrote: > >> @Jesper, curious how you determined that? >> Is it in the spec? or the source? >> Or is this a common GC patter

Re: [go-nuts] Introspecting a built Go application - how?

2017-04-21 Thread Bakul Shah
On Fri, 21 Apr 2017 11:45:02 PDT "'Eric Johnson' via golang-nuts" wrote: > > A question has been bugging me for the past few weeks. How can I tell what > was used to build a Go application? > > As I see various security notices scrolling by my email inbox, I see things > like Tomcat or OpenSS

Re: [go-nuts] Re: Possible to run tests against a specific Go binary?

2017-04-21 Thread st ov
Thank you Ian for providing those details and for pointing me to the code in the source to reference. I'll have a look and respond back if I have any questions. On Friday, April 21, 2017 at 1:18:22 PM UTC-7, Ian Lance Taylor wrote: > > On Fri, Apr 21, 2017 at 12:37 PM, st ov > > wrote: > >

Re: [go-nuts] Re: Constructor return advice

2017-04-21 Thread st ov
Thanks for the confirmation and advice! On Friday, April 21, 2017 at 1:29:02 PM UTC-7, Alan Donovan wrote: > > On 21 April 2017 at 15:26, st ov > wrote: >> >> When deciding between method receivers, any advice on how to choose which >> to use? >> Is it as simple as, when you need to change the

Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-21 Thread David Collier-Brown
Some compilers know that and create a hidden variable (B and C on GCOS, if memory serves) On Thursday, April 20, 2017 at 11:50:39 PM UTC-4, andrey mirtchovski wrote: > > > 297 for i := n - 1; i > 0; i-- { > > "i > 0" is cheaper than "i < n" on some processors :) > > -- You received this mess

[go-nuts] Re: go test: no tests to run

2017-04-21 Thread jmontgomery
Yes, your tests should have the the *same *package name as your code, so in this case *package pybr*. They will not effect the package when built normally. They are only included when running *go test*. You also need to name your tests correctly, and they need a signature like: func TestXxx(*t

[go-nuts] How to do OS Authentication in Oracle with Go?

2017-04-21 Thread Tamás Gulácsi
What do you mean on "os authentication"? (rana/ora dev here) -- 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 op

Re: [go-nuts] Introspecting a built Go application - how?

2017-04-21 Thread andrey mirtchovski
as a first approximation, if you have debug symbols for everything, you can use 'nm' and filter out the Go dependencies which normally do not start with underscore: $ nm `which go` | awk '{print $3}' | sed -n '/^_/p' [snip] __cgo_62033c69288a_Cfunc_CFDataGetBytePtr __cgo_62033c69288a_Cfunc_CFDataG

Re: [go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread Lee Armstrong
Yes it is sorted thank you and it has been a super useful discussion. I had no idea the gravity of calling runtime.GC() and it was a bit of a rabbit hole to get to the bottom of that too as it's not in my code. Appreciate all the replies! Lee On Fri, 21 Apr 2017 at 22:12, wrote: > Lee, > As

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread rlh
Lee, As far as I can tell this is resolved. Thanks for the discussion and for working with stackimpact to fix the root cause. On Friday, April 21, 2017 at 3:52:55 PM UTC-4, Keith Randall wrote: > > It is almost never a good idea to call runtime.GC explicitly. > It does block until a garbage co

[go-nuts] Production Quality Sample Code for Web Services Based on SQL

2017-04-21 Thread golangmike
I am intending to implement a set of simple webservices that are are wrappers on SELECT and UPDATE statements. I would like to study someone else having done this in a production quality code. In particular I would like to see how statements are prepared and the prepared statements are cached.

Re: [go-nuts] Re: Constructor return advice

2017-04-21 Thread 'Alan Donovan' via golang-nuts
On 21 April 2017 at 15:26, st ov wrote: > > When deciding between method receivers, any advice on how to choose which > to use? > Is it as simple as, when you need to change the instance pass a pointer, > otherwise pass a value. And then once one method requires a pointer, then > all methods shoul

Re: [go-nuts] Re: Possible to run tests against a specific Go binary?

2017-04-21 Thread Ian Lance Taylor
On Fri, Apr 21, 2017 at 12:37 PM, st ov wrote: > > So lets say I have a package that relies on a configuration. > In my dev environment I run 'go test' against the package and the > configurations for dev. > It passes the tests so I build out this package and artifact the resulting > binary. > > T

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread 'Keith Randall' via golang-nuts
It is almost never a good idea to call runtime.GC explicitly. It does block until a garbage collection completes. This behavior is sometimes useful in tests, but almost never otherwise. If it weren't for go1 compatibility, we'd rename this function to something that more clearly spells out its

[go-nuts] How to do OS Authentication in Oracle with Go?

2017-04-21 Thread Tieson Molly
I am curious if anyone is connecting to an Oracle database using OS authentication on a linux platform? I have been trying to find code or an example, but I have come up empty handed. Best regards, Ty -- You received this message because you are subscribed to the Google Groups "golang-nuts

Re: [go-nuts] Re: Possible to run tests against a specific Go binary?

2017-04-21 Thread st ov
So lets say I have a package that relies on a configuration. In my dev environment I run 'go test' against the package and the configurations for dev. It passes the tests so I build out this package and artifact the resulting binary. This artifact then continues to a staging environment that has

[go-nuts] Re: Constructor return advice

2017-04-21 Thread st ov
Thanks! So the type's method receiver should be the deciding factor. And method receivers for a type should be either *all* pointers or *all* values. When deciding between method receivers, any advice on how to choose which to use? Is it as simple as, when you need to change the instance pass a

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread lesmond
Interestingly stackimpact.com just updated their code to remove the runtime.GC() calls. It has made a HUGE difference to the GC pauses. The code was updated just before 19:30. Interesting that the manual call had such an impact!

[go-nuts] go test: no tests to run

2017-04-21 Thread Tong Sun
Hi, Thanks you all that helped. I choose the first option, and am now facing a new problem -- when I run go test -v ./... I got "no tests to run" even though I have a _test file: https://github.com/go-cc/cc-table/blob/master/cc-pinyin-range/pinyin_test.go For other directories, I got "no te

[go-nuts] Re: Constructor return advice

2017-04-21 Thread adonovan via golang-nuts
On Friday, 21 April 2017 12:28:25 UTC-4, st ov wrote: > > In general, is it advisable to return pointers to newly constructed > instances when using constructors? > > Would it matter more for types that don't have members of composite types > slice and maps? > So in the following example, https:

[go-nuts] Introspecting a built Go application - how?

2017-04-21 Thread 'Eric Johnson' via golang-nuts
A question has been bugging me for the past few weeks. How can I tell what was used to build a Go application? As I see various security notices scrolling by my email inbox, I see things like Tomcat or OpenSSL announcing security updates, the JRE, or for that matter, Go itself. Once I see one

[go-nuts] Re: OpenGL Fonts

2017-04-21 Thread ajstarks
My OpenVG go wrapper uses TTF files: See: github.com/ajstarks/openvg On Wednesday, April 19, 2017 at 8:57:53 PM UTC-4, saif wrote: > > have found that you can do TTF to OpenVG. > but not sure how gl on go mobile will render slant lines for W. > > if you happen to know this is not the ideal way,

[go-nuts] [ann] codecommit-package-server

2017-04-21 Thread Aldrin Leal
Hey there, I've written a small golang api to work as a package redirector for AWS CodeCommit repositories for go get. Thus, if you've got a repo called "whatever" on CodeCommit, you can simply refer into it as "codecommit.ingenieux.io/repo/whatever". Not fancy, but it works for me :) Source is

Re: [go-nuts] Large GC pauses with large map

2017-04-21 Thread lesmond
I cheated, I used godep to put everything into a /vendor folder and then did a quick search. Turns out the only calls are in the stackimpact.com code! https://github.com/stackimpact/stackimpact-go/search?utf8=✓&q=runtime.GC%28%29&type= I've reached out to them but any insight there would be

Re: [go-nuts] Large GC pauses with large map

2017-04-21 Thread lesmond
Anyone think of an easy way to search for it's usage? 😆 On Friday, April 21, 2017 at 6:11:25 PM UTC+1, Lee Armstrong wrote: > > Thanks again all, > > Interestingly I noticed the same and my code does not call runtime.GC() so > that is a good spot. > > I wonder if something I have imported is doin

Re: [go-nuts] Large GC pauses with large map

2017-04-21 Thread lesmond
Thanks again all, Interestingly I noticed the same and my code does not call runtime.GC() so that is a good spot. I wonder if something I have imported is doing so, I will audit all of the imports and take a look! On Friday, April 21, 2017 at 6:08:02 PM UTC+1, Jesper Louis Andersen wrote: > >

Re: [go-nuts] Large GC pauses with large map

2017-04-21 Thread Jesper Louis Andersen
On Fri, Apr 21, 2017 at 5:58 PM st ov wrote: > @Jesper, curious how you determined that? > Is it in the spec? or the source? > Or is this a common GC pattern that you presume is being used? > > There are a couple of design documents by Clements and Hudson which are worth reading. They are well wr

Re: [go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread Jesper Louis Andersen
On Fri, Apr 21, 2017 at 5:22 PM wrote: > Managed to find time to run it quickly before the end of UK time... > > gc 62 @368.812s 3%: 0.027+770+0.070 ms clock, 0.054+188/386/412+0.14 ms > cpu, 467->485->250 MB, 495 MB goal, 2 P > gc 63 @375.551s 3%: 0.041+0+360 ms clock, 0.082+188/386/412+720 ms c

Re: [go-nuts] Re: Possible to run tests against a specific Go binary?

2017-04-21 Thread Ian Lance Taylor
On Fri, Apr 21, 2017 at 9:30 AM, st ov wrote: > Is it not possible? The doc seems to say that 'go test' recompiles each > package tested > https://golang.org/cmd/go/#hdr-Test_packages `go test` is for testing packages separately. I don't really know what you mean by "run tests against a specific

[go-nuts] Re: Possible to run tests against a specific Go binary?

2017-04-21 Thread st ov
Is it not possible? The doc seems to say that 'go test' recompiles each package tested https://golang.org/cmd/go/#hdr-Test_packages On Thursday, April 20, 2017 at 10:00:24 AM UTC-7, st ov wrote: > > As part of a build pipeline, I want to initially artifact the Go binary to > send through all

[go-nuts] Constructor return advice

2017-04-21 Thread st ov
In general, is it advisable to return pointers to newly constructed instances when using constructors? Would it matter more for types that don't have members of composite types slice and maps? So in the following example, https://play.golang.org/p/sWTWkHfZfB Bar is made up of mostly strings, s

[go-nuts] Re: about the []byte -> string comversion optimization, is it some weird?

2017-04-21 Thread T L
On Friday, April 21, 2017 at 1:33:57 AM UTC+8, Keith Randall wrote: > > > > On Wednesday, April 19, 2017 at 3:56:21 AM UTC-7, T L wrote: >> >> >> >> On Wednesday, April 19, 2017 at 3:37:29 AM UTC+8, Keith Randall wrote: >>> >>> This is a weird corner case in string concatenation optimization. >>>

Re: [go-nuts] Large GC pauses with large map

2017-04-21 Thread st ov
@Jesper, curious how you determined that? Is it in the spec? or the source? Or is this a common GC pattern that you presume is being used? On Thursday, April 20, 2017 at 7:01:03 AM UTC-7, Jesper Louis Andersen wrote: > > A somewhat common culprit seems to be the following case: > > 1. In order

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread lesmond
Managed to find time to run it quickly before the end of UK time... gc 1 @0.114s 0%: 0.088+2.1+0.068 ms clock, 0.17+0.14/0/2.1+0.13 ms cpu, 5->5->3 MB, 6 MB goal, 2 P gc 2 @0.117s 1%: 0.035+3.0+0.051 ms clock, 0.071+0.076/2.9/0+0.10 ms cpu, 7->7->6 MB, 8 MB goal, 2 P gc 3 @0.123s 1%: 0.020+2.6+0

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread lesmond
It will be tough to reproduce in an example as it's quite highly embedded into a large project. It does seem that moving away from pointers may help improve the situation from what Egon has said. I will try and capture the gctrace next week. The graphs were obtained from stackimpact.com which

Re: [go-nuts] [ANN] sqlite

2017-04-21 Thread pierre . curto
This looks really interesting... I also saw a similar idea with a different approach: https://github.com/elliotchance/c2go. Le vendredi 21 avril 2017 16:38:38 UTC+2, Andy Balholm a écrit : > > As near as I can tell, this is an intermediate step in a project whose > ultimate goal is to compile s

Re: [go-nuts] [ANN] sqlite

2017-04-21 Thread Andy Balholm
As near as I can tell, this is an intermediate step in a project whose ultimate goal is to compile sqlite into Go—asm.go (a style like asm.js), apparently. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread rlh
How did you generate the GC pause graphs? Could also provide the output from "GODEBUG=gctrace=1 yourApp"? It would help confirm that it is a GC pause problem. Also some insight into the number of cores / HW threads and the value of GOMAXPROCS could eliminate some possibilities. A reproducer woul

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread Egon
On Friday, 21 April 2017 11:44:45 UTC+3, Lee Armstrong wrote: > > Thanks all. > > Jesper: I will try those things and may look to force a GC when I do my > redcuing of the map. Your explanation was very useful! > The application is processing a fast stream from RabbitMQ so yeah there is > a lot

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread lesmond
Thanks all. Jesper: I will try those things and may look to force a GC when I do my redcuing of the map. Your explanation was very useful! The application is processing a fast stream from RabbitMQ so yeah there is a lot of throughput onto this map. Egon: Can you explain what to and why this wo

[go-nuts] Re: Large GC pauses with large map

2017-04-21 Thread lesmond
Thanks all. Jesper I will try those things and may look to force a GC when I do my redcuing of the map. Your expla On Friday, April 21, 2017 at 3:39:07 AM UTC+1, 刘桂祥 wrote: > > try use value type > example: > map[string]*struct => map[[20]byte]struct > > 在 2017年4月20日星期四 UTC+8下午9:49:49,Lee Ar

Re: [go-nuts] [ANN] sqlite

2017-04-21 Thread Jan Mercl
On Fri, Apr 21, 2017 at 7:03 AM Jérôme LAFORGE wrote: > It is driver only or that contains also the process that manages the data via sql? The driver works in-process by calling into an included virtual machine that's loaded by code compiled from sqlite3.c via go generate. Connection to a datab

Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-21 Thread Ian Davis
On Fri, 21 Apr 2017, at 03:31 AM, Ivan Kurnosov wrote: > @Rob, > > honestly to me they look the same: > > > func IsSorted(data Interface) bool { > n := data.Len() for i := n - 1; i > ; i-- { if data.Less(i, i-1) { >return false } } return true } > > > func IsSortedForward(data sor