Hacker News new | past | comments | ask | show | jobs | submit | studmuffin650's favorites login

Go does has some form of monomorphization implemented in Go1.18; it is just behind a feature flag(compiler flags).

Look at the assembly difference between this two examples:

1. https://godbolt.org/z/7r84jd7Ya (without monomorphization)

2. https://godbolt.org/z/5Ecr133dz (with monomorphization)

If you don't want to use godbolt, run the command `go tool compile '-d=unified=1' -p . -S main.go`

I guess that the flag is not documented because the Go team has not committed themselves to whichever implementation.


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: