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
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
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
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,
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
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
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
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
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
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
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
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
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
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
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
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
--
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
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,
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
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)
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
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
> &
22 matches
Mail list logo