@go101 In your example it's just that the nil pointer check is outside the loop in g1 but inside the loop in g0. We'd need to lift the nil check out of the loop to make them the same speed. Which I believe is #41666.
changed the title
cmd/compile: strange performacne difference between two implementationsNov 25, 2021