[go-nuts] Re: time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread ranqus
I ran the test code provided by the article, and got result: % time seconds usecs/call callserrors syscall -- --- --- - - 100.000.000418 4 100 gettimeofday -- --- --- - -

Re: [go-nuts] What is Spinning thread doing in go scheduler

2018-05-24 Thread Ian Lance Taylor
On Tue, May 22, 2018 at 9:26 AM, Ming Hu wrote: > > I am reading the design of go scheduler, and don't quite understand this in > "Scalable Go Scheduler Design Doc" > > https://docs.google.com/document/d/1TTj4T2JO42uD5ID9e89oa0sLKhJYD0Y_kqxDv3I3XMw/edit# > >> Spinning is mostly passive (yield to O

[go-nuts] Re: time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Uli Kunitz
On my 9 year old Core i7 950 3 GHz on Ubuntu 16.04 I get 54 ns/op for your test using go1.10.2. On Thursday, May 24, 2018 at 7:48:50 PM UTC+2, Uli Kunitz wrote: > > The following explanation might be relevant: > > > https://blog.packagecloud.io/eng/2017/03/08/system-calls-are-much-slower-on-ec2

[go-nuts] Re: time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Uli Kunitz
The following explanation might be relevant: https://blog.packagecloud.io/eng/2017/03/08/system-calls-are-much-slower-on-ec2/ The Go runtime, at least for 1.10, supports VDSO on Linux. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

[go-nuts] Re: Printfln on fmt and log

2018-05-24 Thread 'Eric Johnson' via golang-nuts
Hi Anirudh, On Tuesday, May 22, 2018 at 4:29:59 PM UTC-7, Anirudh Vyas wrote: > > Hi - > > I want to have a Printfln on log and fmt - Currently I use fmt.Printf( " > yada yada \n", some_yada_yada) to achieve same effect. Is there a plan to > add this simple yet extremely useful function? > I

Re: [go-nuts] time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Tamás Gulácsi
Antivirus? -- 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/optout.

[go-nuts] Re: I am confused.

2018-05-24 Thread David Skinner
If you want to learn GO, the easiest and best way to start is with https://play.golang.org/ You write your code using any browser, run the code on a remote server, you can see the results, you can share your code simply by sharing a link. There are all sorts of documentation online. If you want

Re: [go-nuts] Why doesn't this select statement timeout?

2018-05-24 Thread alex . rou . sg
No, not the entire case statements, only the statements on the right of the "<-" btw if you run it out of the playground (which makes concurrency more deterministic) You would get timeout sometimes and nil sometimes Also maybe this example would help you understand what's going on. https://play

[go-nuts] Re: I am confused.

2018-05-24 Thread bucarr
When you open VS Code there is a welcome screen. On the left side of the screen you open/create a program filename to work on. Note the BLUE vertical line separating the narrow left window from the larger right window where you do your program editing. Toward the bottom of that window you'll

Re: [go-nuts] time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread ranqus
I was suspecting the hardware too, but I tested the benchmark on Go 1.8 , and found it can do 1825 ns/op. It's still slow though (maybe related to problems on my OS/hardware), but it way faster than the one und

[go-nuts] Freeing memory of a cgo library

2018-05-24 Thread Liron Levy
Hey guys, I'm in a bit of a mass, I can not see how I'm getting out of... What do I got: * A library I built using cgo. * A cpp app using this library (dll). What do I do: I try to free memory I have allocated in the cgo library in the cpp app. What Tools do I use: To build the library (dll) I u

Re: [go-nuts] http.req.URI.Scheme inside is empty?

2018-05-24 Thread ernest
if your service is behind some TLS terminating hop then you could also inspect the X-Forwarded-Proto header if available. On Thursday, 1 March 2012 23:54:10 UTC+1, Andrew Gerrand wrote: > > On 1 March 2012 22:06, Johann Höchtl > > wrote: > > > > but req.URL is constructed by parsing the Request

Re: [go-nuts] time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Jesper Louis Andersen
On Thu, May 24, 2018 at 10:08 AM wrote: > > After I benchmark time.Now on my computer, I found that the time.Now > takes about 3758 ns to perform one operation, which is not very fast. The > benchmark is here > > (benchmarked on my

Re: [go-nuts] time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Jakob Borg
Sorry, I think the change I was thinking of was macOS specific, and in any case it’s in Go 1.10. On 24 May 2018, at 11:15, ran...@gmail.com wrote: What has been changed? And since when? I may need dig into it for more detail. I've tested on both 1.10 and devel +65c365bf

Re: [go-nuts] time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread ranqus
What has been changed? And since when? I may need dig into it for more detail. I've tested on both 1.10 and devel +65c365bf0f Wed May 23 23:51:30 2018 + linux/amd64, the result is the same (slow). On Thursday, May 24, 2018 at 4:37:47 PM UTC+8, Jakob Borg wrote: > > Are you using the latest

[go-nuts] Re: time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread ranqus
Thanks guys, guess that's my machine or the OS. On Thursday, May 24, 2018 at 4:08:36 PM UTC+8, ran...@gmail.com wrote: > > I been working on something performance intensive lately, one feature of > it require me to calculate the time gap between operation which require > time.Now to make time ma

Re: [go-nuts] Why doesn't this select statement timeout?

2018-05-24 Thread gopher . nutter
Thanks for the reply. So you're saying that all case statements are evaluated first before a choice is made. Which means that the full request/response must complete even if the timeout case finishes first. If I swap the cases, now I consistently get a `timeout`. All cases are run to completio

Re: [go-nuts] time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Jakob Borg
Are you using the latest version of Go? time.Now() has been optimized recently. On 24 May 2018, at 10:08, ran...@gmail.com wrote: I been working on something performance intensive lately, one feature of it require me to calculate the time gap between operation which requ

[go-nuts] Re: time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread lafolle
Don't know why but on my machine its faster: goos: linux goarch: amd64 pkg: playground/bench-time-now BenchmarkTimeNow-8 300049.3 ns/op PASS Showing top 10 nodes out of 16 flat flat% sum%cum cum% 1.02s 65.81% 65.81% 1.02s 65.81% runtime._Exte

Re: [go-nuts] time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread Jan Mercl
On Thu, May 24, 2018 at 10:08 AM wrote: > So, I want to know is that normal to be this slow? I think it's not normal. jnml@r550:~/src/tmp> cat x_test.go package main import ( "testing" "time" ) func BenchmarkTimeNow(b *testing.B) { for i := 0; i < b.N; i++ { time.Now() } } jnml@r550:~/src/tmp

[go-nuts] time.Now takes ~3758 ns/op, is that normal?

2018-05-24 Thread ranqus
I been working on something performance intensive lately, one feature of it require me to calculate the time gap between operation which require time.Now to make time marks. After I benchmark time.Now on my computer, I found that the time.Now takes about 3758 ns to perform one operation, which