Re: [go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-03 Thread Kurtis Rader
On Sun, Feb 3, 2019 at 10:47 PM Amnon Baron Cohen wrote: > If you really care about each nanosecond of execution time, and are > prepared to do a lot of work > to minimise run-time, then C, C++ or Rust may be your best choice. But for > most of us here, Go does hit the sweetspot. > Bingo! For th

[go-nuts] Re: plugins (Go 1.8) and packages

2019-02-03 Thread niklasro
It looks like an issue or bug that GoLang includes the runtime in plugins so that they cannot be shared. I did go install -buildmode=shared std And then I try to compile my plugin as shared: go build -buildmode=plugin -linkshared /tmp/code_SUM.go# command-line-arguments runtime.islibrary: mis

[go-nuts] Why is "v" prefix for VCS tag required for ?

2019-02-03 Thread gudvinr
Now go mod requires to have prefix "v" for it's tag in VCS and it's mandatory so you can't use tags in form of "A.B.C" in your workflow. But this limitation has little to zero reason to exist so why is it strict requirement? Why not to allow use both "vA.B.C" and "A.B.C" tags? Who are using "A.B

[go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-03 Thread Amnon Baron Cohen
If you like these kind of benchmarks https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/go-gpp.html may be what you are looking for. In these results Go is generally half the speed of C, but 50 times faster than python. Go does not attempt to generate the fastest code at all cos

[go-nuts] Profiling runtime.futex

2019-02-03 Thread Andrew Medvedev
Hi everybody I have a simple program which parses IP addresses and adds them to the system routing table using the netlink library. The number is routes is huge (400_000). My parsing part is very simple and fast, and most of the time is spent in system calls: File: loadroutes Type: cpu T

Re: [go-nuts] Naming convention for accessor functions?

2019-02-03 Thread Ian Denhardt
Some standard library function names to possibly take inspiration from: * regexp.MustCompile * template.Must. Quoting Randall O'Reilly (2019-02-03 23:26:04) > I’m trying to figure out the best convention for the basic function of > accessing elements in a container (specifically in the context o

Re: [go-nuts] Naming convention for accessor functions?

2019-02-03 Thread robert engels
I am sure the Go purists are going to say that the version that returns nil for the object with no error return are not idiomatic Go... > On Feb 3, 2019, at 10:26 PM, Randall O'Reilly wrote: > > I’m trying to figure out the best convention for the basic function of > accessing elements in a co

[go-nuts] Naming convention for accessor functions?

2019-02-03 Thread Randall O'Reilly
I’m trying to figure out the best convention for the basic function of accessing elements in a container (specifically in the context of GUI elements in the case of GoGi / GoKi https://github.com/goki/gi, and also in our new biological neural network simulator in Go: https://github.com/emer/emer

[go-nuts] Re: How to renderer the multiple html pages ?

2019-02-03 Thread bucarr
What is the error? On Saturday, February 2, 2019 at 10:54:53 PM UTC-7, Robert Hsiung wrote: > > Hi all: > I make three html pages as index.html ,wps1.html and wps2.html. The > three html pages are under the same folder. > The expected flow is to login index.html first and access wps1 or wps2

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Miki Tebeka
Thanks. You're right - this is not the way to choose a language. I was just curious. Go has many, many more things going for it - multi core support, networking, standard library, community ... On Sunday, February 3, 2019 at 8:56:28 PM UTC+2, robert engels wrote: > > It will also depend on which

[go-nuts] Re: Channel from io.Reader

2019-02-03 Thread 'simon place' via golang-nuts
seems to me... channels are for language-handled concurrency which is able to then, transparently, be parallel, readers are a single threaded thing that mimics concurrency, they do it explicitly. so you need to 'drive' the readers by calling them all in a loop, handling any none zero length, t

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread robert engels
I will take an experienced architect or city planner with a track record of success over any ‘isolated numerical comparison’. Comparisons need to be made in their entirety, and this is a skill set that often cannot be taught, and is learned via human experience. It is similar to how many AI syst

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Milind Thombre
Right! Just Listen to what ever the Architect's (or City Planner's) opinion is, implement it, and we in all certainty have a performant system. Numerical Evidence is for dummies Whatever! On Mon, Feb 4, 2019 at 12:18 AM Robert Engels wrote: > I’ll state again, it’s because these benchmarks

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Bakul Shah
Suggestion: specify all relevant details as we don’t know what kind of machine you have. I suspect your machine is a 64bit word size machine. C ints are typically 4 bytes even on 64bit word size machines. Go ints are 8 bytes on these machines. Suggestion2: look at the generated assembly languag

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Robert Engels
It will also depend on which math library and compiler options you use on the C side. I’ll give you a bit of a warning though, if you are making decisions based solely on tests like this you you might be missing the bigger picture of the value of systems like Go. A simple example, even 1.5 s

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Miki Tebeka
Yup. Using int32 in Go reduces the difference to 1.5. Thanks On Sunday, February 3, 2019 at 8:35:46 PM UTC+2, Robert Engels wrote: > > Also the go program is most likely using 64 bit math. Use int32 to compare > it correctly. > > On Feb 3, 2019, at 12:31 PM, Robert Engels > wrote: > > Don’t use

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Robert Engels
I’ll state again, it’s because these benchmarks have little to do with the success of systems. Experienced designers know this. Take, architecture, barring some large scale dynamics, everyone would build simple boxes. It doesn’t mean the project will be a commercial success, most likely not. T

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Milind Thombre
This is exactly why I asked a day or two ago if there has been a quantitative performance study/Benchmarking study done, but nobody seems to have the time to contribute to it. Are we expected to mindlessly adopt whatever "New" technology is doled out without quantitative proof of its degree of good

Re: [go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-03 Thread Robert Engels
You are using g 64 bit in Go and 32 bit in C > On Feb 3, 2019, at 12:33 PM, Miki Tebeka wrote: > > A bit of profiling shows that the modulo operator takes most of the time: > > 1.77s 1.77s (flat, cum) 100% of Total > . . 2: > . . 3:import (

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Robert Engels
Also the go program is most likely using 64 bit math. Use int32 to compare it correctly. > On Feb 3, 2019, at 12:31 PM, Robert Engels wrote: > > Don’t use rtdsc in the C program use gettimeofday to ensure you are comparing > the same. > >> On Feb 3, 2019, at 12:22 PM, Miki Tebeka wrote: >>

[go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-03 Thread Miki Tebeka
A bit of profiling shows that the modulo operator takes most of the time: 1.77s 1.77s (flat, cum) 100% of Total . . 2: . . 3:import ( . . 4: "testing" . . 5:) . . 6: 10m

Re: [go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Robert Engels
Don’t use rtdsc in the C program use gettimeofday to ensure you are comparing the same. > On Feb 3, 2019, at 12:22 PM, Miki Tebeka wrote: > > Hi, > > I'm comparing two loops in Go and C. The Go code on my machine is about 3 > times slower than C. I know C can be faster but didn't think it'll

[go-nuts] Go vs C speed - What am I doing wrong?

2019-02-03 Thread Miki Tebeka
Hi, I'm comparing two loops in Go and C. The Go code on my machine is about 3 times slower than C. I know C can be faster but didn't think it'll be that faster. Any ideas what's making the Go code slower? You can see the code at https://github.com/tebeka/go-c-loop Go Code: package main impor

[go-nuts] Type inference

2019-02-03 Thread 伊藤和也
In all the constant and variable declarations below, is type inference used? If not, which declarations use type inference? (a) const num1 = 100 (b) var num2 = num1 (c) const num1 = int(100) (d) num2 := num1 -- You received this message because you are subscribed to the Google Groups "golang-n

[go-nuts] Type inference

2019-02-03 Thread 伊藤和也
In all the variable and constant declarations below, is type inference used? If not, which declarations use type inference? (1) var num1 = 100 (2) var num2 = num1 (3) num1 := 100 (4) num2 := num1 (5) const num1 = 100 (6) const num2 = num1 -- You received this message because you are subscribe

[go-nuts] url.parse issue if the first character of a url is a number

2019-02-03 Thread Tamás Gulácsi
An url must start with a scheme (i.e. http://). -- 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