On Tuesday, August 16, 2022 at 1:03:22 PM UTC-7 guil.l...@gmail.com wrote:

> Hello,
>
> I remember a paper about Go Generics but I cannot find it again.
> It was a scientist paper (with a lot of maths far beyond my understanding 
> ^^).
> Title was something like "Lightweigh generics for Go" or something like 
> that.
> I believe the background of the website was red (not sure either).
> If someone has the url, please share it :)
>
> In the same idea, I believed the Go Generics solves the "bloating binary" 
> issue. If so, I don't understand why I see the "same instructions" at ligne 
> 68-71 and at ligne 81-84 in this exemple : https://godbolt.org/z/cqY19PT7q. 
> I'm not fluent with assembler but, for me there is a bloating there.
>
> Can someone explain it to me ? :)
>

Go generics takes a step towards fixing the bloating binary issue, "solved" 
is too strong a word.
Instead of generating one implementation per instantiation, we generate one 
per "instantiation shape". In your example, int and uint must have 
different shapes because the > operator requires different code for each of 
them (JGE vs JCC).
But if you had
type A int
type B int
then max[A], max[B], and max[int] would all use the same instantiation.
 

> Thanks in advance
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d4a2fc7e-618d-454f-8fff-dfc63b4011ean%40googlegroups.com.

Reply via email to