Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: improve generated type equality code #9930
geneq generates a series of if statements, each returning false if they fail. Creating instead a long conjunction would result in shorter, faster generated code.
It might also be worth reordering the tests to place all the ones involving a function call last.
It might also be worth trying to prevent some of the spurious checknils that are currently produced. In some cases know that we are dereferencing fields on a struct (not a pointer to a struct).
We also appear to be generating equality routines when we shouldn't be. The following strike me as possibly spurious:
Look into these.
Given all the above, it might be worth also taking a closer look at the generated hash routines as well.
I'll poke at these once the c2go conversion is complete.
There's plenty of low-hanging fruit here, but I'm not convinced that it is worth it at this stage in the cycle.
(The last six commits in https://github.com/josharian/go/commits/gc-improve-alg cut 100k off the godoc binary size, and generate better eq code, but that's only ~0.5% of the binary, and I don't see the benchmark numbers move much.)
For Go 1.6, we can pull in those commits and take another pass. I've not looked at the hash routines at all, and I think we're generating way too many alg routines. This won't be as big a deal once the linker can strip them, but it's still pointless.