Skip to content

Go: exponentially bad/absymal performance as of ... #3934

@kirides

Description

@kirides
  • target information: Go go get -u github.com/antlr/antlr4/runtime/Go/antlr/v4@d5dd253 (same with plain /v4)
  • smallest possible grammar and code that reproduces the behavior

Expected

Parsing 19 files should take around 0.2s

Actual

Parsing 19 files takes more than 11s, and exponentially more the more files there are

Happens as of f19dc0e (~5.5s)
Got worse with 56df72c (~10s)

See example in attached zip: (includes sample files and grammar)
issue.zip

To test old and new behaviour, just toggle the commented lines in go.mod and run
go mod tidy && go test -timeout 30s -run ^TestParsing$ issue -count=1

EDIT: after removing all leading conditional values (summary comments) and putting them into a hidden channel, performance was still a bit lower (~20%) but much, MUCH better than whatever that issue is

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions