go: cmd/compile: compilation of a package >100x slower with 1.20rc3

The package in question is https://github.com/benoitkugler/textlayout/fonts/glyphsnames in v0.3.0, with go 1.19:

$ go version
go version go1.19.1 linux/amd64
$ time go build

real	0m4,086s
user	0m5,970s
sys	0m0,447s

with go 1.20rc3 I got bored of waiting after 10 minutes, so it’s at least 100x slower, but possibly a lot more (for all I know it could be in an infinite loop).

The code in question seems to have some very large (and very questionable) switch statements.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

there’s a 12000 line / 6000 case switch in there

This is fixed at tip. Milestoning for 1.20 for the backport.

main » time go1.19.5 build -a               
go1.19.5 build -a  9.57s user 0.79s system 279% cpu 3.702 total

main » gotip version         
go version devel go1.21-e2fe35363d0 Mon Jan 23 10:02:20 2023 +0000 linux/amd64

main » time gotip build -a
gotip build -a  3983.07s user 58.04s system 771% cpu 8:43.65 total