Golang performance issues

58 views
Skip to first unread message

Alexander Lazar

unread,
May 16, 2022, 8:12:27 PM5/16/22
to antlr-discussion
On a simple rule of:

```
1 EQ 2 OR
1 EQ 2 OR
1 EQ 2 OR
1 EQ 2 OR
1 EQ 2
```

golang will take exponentially more time to parse (visitor) for each additional `1 EQ 2 OR` added. Eg 5s with 8 of them, 20s with 9, 60s with 10. 

Python compiles essentially instantly. I don't work with other languages. 

Working on a small repro repo but the grammar is exactly what you'd expect for a simple language to compare things. Given that Python doesn't face this issue I can't imagine I'm doing something terrible in my grammar. 

Issue goes away if I put parens on things but that's not a real solution. 

On 4.10.1, first noticed with 4.9.1. 

Any help is greatly appreciated. Surprised I can't find others with this issue. 

Alexander Lazar

unread,
May 16, 2022, 9:15:54 PM5/16/22
to antlr-discussion

Terence Parr

unread,
May 20, 2022, 5:46:05 PM5/20/22
to antlr-discussion
hi. Nothing seems crazy with your grammar so it's probably an issue with the Go runtime. Thanks for pointing this out. I see you have created an issue. Thank you.

--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/antlr-discussion/27b0db60-edf6-4a3b-be66-883d9d3a10abn%40googlegroups.com.


--
Dictation in use. Please excuse homophones, malapropisms, and nonsense.
Reply all
Reply to author
Forward
0 new messages