ANTLR 4 performance

1,085 views
Skip to first unread message

Edu García

unread,
Jun 3, 2014, 7:56:31 AM6/3/14
to antlr-di...@googlegroups.com
Hi,

I hope this post doesn't fall in the "already discussed a hundred times" category. I really love ANTLR, and I've used successfully for many small DSLs (although that was with v2, a long time ago).

This time, I wanted to create a plugin for another software I love: IntelliJ IDEA. I've used GrammarKit in the past, with some difficulties, but seeing the awesome work Terence Parr & Co are doing on the IntelliJ plugin, I wanted to give it a go.

When checking for existing grammars for the language I want (Rust), I stumbled across https://github.com/jbclements/rust-antlr. The author says that his full parser parses all existing (at the time) Rust code, but it's so slow that it's difficult to check.

I don't expect anyone to go over that grammar and tell me why, but more like: Is ANTLR suitable to do a parser big and fast enough to parse a language like Rust or Java in realtime for IDE support?

Thank you, and again I hope this is a valid question.

Jonathan Coveney

unread,
Jun 3, 2014, 8:48:04 AM6/3/14
to antlr-di...@googlegroups.com
Terence can of course comment, but this has come up before (at least about Java): https://groups.google.com/forum/#!topic/antlr-discussion/aAyGkDU18IA

You can decide if that is fast enough but I am pretty sure it should be fast enough.


--
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.
For more options, visit https://groups.google.com/d/optout.

Edu García

unread,
Jun 3, 2014, 8:54:34 AM6/3/14
to antlr-di...@googlegroups.com
Thank you so much for your comment, Jonathan.

I didn't find that before in my search, very useful indeed. Interesting the assertion of Terence about parsing the whole JDK in 7 seconds, will be nice to know with what grammar (not sure if he means with the linked one or a private one).

Anyway, if it's true, for what I read I just need to be careful of my grammar needing LL and enabling SLL, this is very reassuring. I just didn't want to start creating a big grammar only to find that there was no possibility to make it faster (because I'm sure that whatever I write, will be very slow at the beginning :D)

Jonathan Coveney

unread,
Jun 3, 2014, 8:56:40 AM6/3/14
to antlr-di...@googlegroups.com
There are a LOT of levers to pull that can affect grammar performance, especially for a big grammar. ANTLR4 is quite performant, but to get it to light speed you're going to have to restrict how much ANTLR4 cleverness you use, because certain cases can be handled, but not efficiently. I'd get started and bring any pathological cases here. ANTLR4 is being pretty actively developed, at least as I've observed.


--

Terence Parr

unread,
Jun 3, 2014, 10:29:57 AM6/3/14
to antlr-di...@googlegroups.com
hi all. new intellij plugin with profiler out this week i hope. identifies problem areas :)

also see


Ter

Edu García

unread,
Jun 3, 2014, 4:22:50 PM6/3/14
to antlr-di...@googlegroups.com

Awesome, I saw your tweet before but didn't know when was the planned date.

Even if you don't have the profiler finished, I think you should do a release, as the plugin seems to be broken on 13.1 (NPEs when doing live preview for example). After compiling from github, everything seems to work.

You received this message because you are subscribed to a topic in the Google Groups "antlr-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antlr-discussion/Dv4ytvH5-nM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antlr-discussi...@googlegroups.com.

Terence Parr

unread,
Jun 3, 2014, 4:32:55 PM6/3/14
to antlr-di...@googlegroups.com
see last email
On Jun 3, 2014, at 1:22 PM, Edu García <arc...@gmail.com> wrote:

Awesome, I saw your tweet before but didn't know when was the planned date.

Even if you don't have the profiler finished, I think you should do a release, as the plugin seems to be broken on 13.1 (NPEs when doing live preview for example). After compiling from github, everything seems to work.

On Jun 4, 2014 12:29 AM, "Terence Parr" <pa...@cs.usfca.edu> wrote:
hi all. new intellij plugin with profiler out this week i hope. identifies problem areas :)

also see


Ter
<profiler.png>
Reply all
Reply to author
Forward
0 new messages