Re: [go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Vincent Blanchon
With 100 constants: Stringer-4 4.96ns ± 0% StringerWithSwitch-4 4.99ns ± 1% StringerWithMap-4 30.40ns ± 0% The gap between the switch and the current implement is much smaller. I guess it is due to the number of JMP instructions the code has to go through. It confirms that

Re: [go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Vincent Blanchon
Yes, definitely, good point. Both are them are good depending on the case actually. Le mardi 18 février 2020 16:55:02 UTC+4, Jan Mercl a écrit : > > On Tue, Feb 18, 2020 at 1:47 PM Vincent Blanchon > > wrote: > > > However, in real code, I guess we will have that many con

[go-nuts] issue with past-the-end pointer

2020-03-18 Thread Vincent Blanchon
Hi all, In this proposal https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md, it is mentioned past-the-end pointer and the fact it should be avoided. My assumption is that it could lead to a bad memory tracking/cleaning since the write barriers keep trac

Re: [go-nuts] issue with past-the-end pointer

2020-03-18 Thread Vincent Blanchon
Thank you Ian! Le mercredi 18 mars 2020 23:20:15 UTC+4, Ian Lance Taylor a écrit : > > On Wed, Mar 18, 2020 at 9:33 AM Vincent Blanchon > > wrote: > > > > In this proposal > https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md,

[go-nuts] "Timers rely on the network poller", why is that?

2020-04-17 Thread Vincent Blanchon
Hi everyone, >From what I understand, timers are ran by: - the P holding them - other P if timer-stealing happen (thanks to the async preemption that should not happen often) - sysmon thread that, periodically, check if some timers have to run But, in the comments of the code, I have seen this s

[go-nuts] External/internal linker and cgo packages

2020-04-28 Thread Vincent Blanchon
Hello, I'm building a simple program that has a dependency to github.com/DataDog/zstd, a wrapper of a C code. So by default, Go will use the external linker. When debugging with, I can see host link: "clang" "-m64" "-Wl,-headerpad,1144" "-Wl,-no_pie" "-Wl,-pagezero_size,400" "-o" "/var/fo

Re: [go-nuts] External/internal linker and cgo packages

2020-04-29 Thread Vincent Blanchon
2020 07:52:03 UTC+4, Ian Lance Taylor a écrit : > > On Tue, Apr 28, 2020 at 10:49 PM Vincent Blanchon > > wrote: > > > > I'm building a simple program that has a dependency to > github.com/DataDog/zstd, a wrapper of a C code. > > So by default, Go will u

[go-nuts] Go compiler - syntax tree vs AST?

2019-09-03 Thread Vincent Blanchon
Hi all, The compiler documentation mentions a syntax tree in the parsing phase when the AST transformation phase mentions a conversion from the syntax tree to the compiler's AST representation. If I do not misunderstand, the command "*go tool compile -W" *will display the AST. I was wondering

Re: [go-nuts] Go compiler - syntax tree vs AST?

2019-09-03 Thread Vincent Blanchon
usage of two different syntax tree was a bit confusing. Hope this helps Yes, a lot. Thanks again! Le mardi 3 septembre 2019 17:54:38 UTC+4, Ian Lance Taylor a écrit : > > On Tue, Sep 3, 2019 at 6:23 AM Vincent Blanchon > wrote: > > > > The compiler documentation men

[go-nuts] CPU profiling with pprof

2019-09-06 Thread Vincent Blanchon
Hi, The documentation of the profiling (https://blog.golang.org/profiling-go-programs) explains that: "Go program stops about 100 times per second". However, in the code, I could see that the collector has a sleep of 100ms https://github.com/golang/go/blob/master/src/runtime/pprof/pprof.go#L779

[go-nuts] garbage collector forced to run every two minutes

2019-09-18 Thread Vincent Blanchon
Hi, I was wondering what problem *gcTriggerTime* is supposed to solve? Why does the language need to force the GC every two minutes if it did not run? Thanks in advance -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Re: causal profiling in Go

2019-09-30 Thread Vincent Blanchon
That's interesting, thanks for sharing. Also interested to know if someone got results with a similar approach. > -- 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

[go-nuts] mcache per P or per M?

2019-11-02 Thread Vincent Blanchon
Hello, Reading the code, I can see the structs m and p hold a mcache instance. I'm curious to understand why both of them need an instance of mcache? Also, I see that those instances are the same ones (runtime/proc.go init the p.mcache with m.cache and vice versa), is it correct? Should we cons

Re: [go-nuts] mcache per P or per M?

2019-11-04 Thread Vincent Blanchon
Thank you, Ian! With the CL it is much more clear now Le mardi 5 novembre 2019 02:27:00 UTC+4, Ian Lance Taylor a écrit : > > On Sat, Nov 2, 2019 at 4:58 AM Vincent Blanchon > > wrote: > > > > Reading the code, I can see the structs m and p hold a mcache ins

[go-nuts] Are M always detached from P when syscall?

2019-11-15 Thread Vincent Blanchon
Hello, I was wondering about the behavior of syscalls. It looks like Go always wraps syscall - whatever blocking or not - with calling entersyscallblock() and exitsyscall() later. The first one automatically detaches M from the P when exit tries to acquire the same P or move the G to the glob

[go-nuts] GOMAXPROCS > num of CPU

2019-12-04 Thread Vincent Blanchon
Hello, I've read on GitHub (https://github.com/golang/go/issues/20303#issuecomment-329418911) "there are good reasons" to set GOMAXPROCS to > num CPU. Just out of curiosity, I want to know if someone has an example of it or any good reason to set it up more than the number of CPUs? Thanks --

[go-nuts] Re: GOMAXPROCS > num of CPU

2019-12-05 Thread Vincent Blanchon
active thread accounting" is accurate in the OS, I dont see > any reason to set it higher. I think it is easy to test >HWthreads effects > with a concurrent cpu-intensive job. > > On Wednesday, December 4, 2019 at 8:24:13 PM UTC+3, Vincent Blanchon wrote: >> >> Hell

[go-nuts] loop & CX register

2020-01-01 Thread Vincent Blanchon
Hi, Here is a loop in Go: https://play.golang.org/p/G4wdLi26LZ4 With looking at the assembly, I can see that the loop counter uses *AX* register while the total (t) use *the CX* register: 0x004c 00076 (main.go:7) INCQ AX 0x004f 00079 (main.go:8) ADDQ DX, CX I have a basic knowledge of assembly,

Re: [go-nuts] loop & CX register

2020-01-01 Thread Vincent Blanchon
I got it, Thank you Ian! Le jeudi 2 janvier 2020 07:36:39 UTC+4, Ian Lance Taylor a écrit : > > On Wed, Jan 1, 2020 at 7:25 PM Vincent Blanchon > > wrote: > > > > Here is a loop in Go: https://play.golang.org/p/G4wdLi26LZ4 > > With looking at the assembly, I

[go-nuts] stringer command and generated String() function

2020-02-17 Thread Vincent Blanchon
Hello, I was wondering why the stringer command has been implemented that way: const _Pill_name = "PlaceboAspirinIbuprofen" var _Pill_index = [...]uint8{0, 7, 14, 23} func (i Pill) String() string { if i < 0 || i >= Pill(len(_Pill_index)-1) { return "Pill(" + strconv.FormatInt(int64(i)

[go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Vincent Blanchon
has not been rerun since. > The const/slice implementation allows for that (useful!) check. > > > Le mardi 18 février 2020 07:42:41 UTC+1, Vincent Blanchon a écrit : >> >> Hello, >> >> I was wondering why the stringer command has been implemented that way: >> &g

Re: [go-nuts] Re: stringer command and generated String() function

2020-02-18 Thread Vincent Blanchon
n "Ibuprofen" case 3: return "Paracetamol" default: return "Pill(" + strconv.FormatInt(int64(i), 10) + ")" } } Le mardi 18 février 2020 14:06:14 UTC+4, Jan Mercl a écrit : > > On Tue, Feb 18, 2020 at 10:37 AM Vincent Blanchon > &